summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-ir-lower-generic-function.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-06-23 12:41:05 -0700
committerGitHub <noreply@github.com>2022-06-23 12:41:05 -0700
commit4aa6344f772d31c1f7b0676cbaf315104c4b30a2 (patch)
tree5fe9ded4256691d1e84ca0d9e3f03693dc4105bf /source/slang/slang-ir-lower-generic-function.cpp
parent5bd366fa1d10b93d0460f7779fa24d1572c971ba (diff)
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 <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-ir-lower-generic-function.cpp')
-rw-r--r--source/slang/slang-ir-lower-generic-function.cpp3
1 files changed, 2 insertions, 1 deletions
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<RTTIObject>.
IRInst* interfaceRequirementVal = nullptr;
- auto witnessTableType = cast<IRWitnessTableType>(lookupInst->getWitnessTable()->getDataType());
+ auto witnessTableType = as<IRWitnessTableType>(lookupInst->getWitnessTable()->getDataType());
+ if (!witnessTableType) return;
auto interfaceType = maybeLowerInterfaceType(cast<IRInterfaceType>(witnessTableType->getConformanceType()));
interfaceRequirementVal = sharedContext->findInterfaceRequirementVal(interfaceType, lookupInst->getRequirementKey());
lookupInst->setFullType((IRType*)interfaceRequirementVal);