From 4aa6344f772d31c1f7b0676cbaf315104c4b30a2 Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 23 Jun 2022 12:41:05 -0700 Subject: Preserve specialization cache in IR for specialization pass. (#2293) * Perserve specialization cache in IR for specialization pass. * Fix compile error. * Fix. * Fix. * Fix test case. * Fix. Co-authored-by: Yong He --- source/slang/slang-ir-lower-generic-function.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source/slang/slang-ir-lower-generic-function.cpp') diff --git a/source/slang/slang-ir-lower-generic-function.cpp b/source/slang/slang-ir-lower-generic-function.cpp index bf20452d7..b50737c23 100644 --- a/source/slang/slang-ir-lower-generic-function.cpp +++ b/source/slang/slang-ir-lower-generic-function.cpp @@ -264,7 +264,8 @@ namespace Slang // If the requirement is a function, interfaceRequirementVal will be the lowered function type. // If the requirement is an associatedtype, interfaceRequirementVal will be Ptr. IRInst* interfaceRequirementVal = nullptr; - auto witnessTableType = cast(lookupInst->getWitnessTable()->getDataType()); + auto witnessTableType = as(lookupInst->getWitnessTable()->getDataType()); + if (!witnessTableType) return; auto interfaceType = maybeLowerInterfaceType(cast(witnessTableType->getConformanceType())); interfaceRequirementVal = sharedContext->findInterfaceRequirementVal(interfaceType, lookupInst->getRequirementKey()); lookupInst->setFullType((IRType*)interfaceRequirementVal); -- cgit v1.2.3