summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir-lower-generic-function.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-04-12 22:58:22 -0700
committerGitHub <noreply@github.com>2023-04-12 22:58:22 -0700
commitca7bf79df3a3f5f4494912cb0572c36662755b9d (patch)
tree64b14034326be8285c0265e74ad3ed11e29ff062 /source/slang/slang-ir-lower-generic-function.cpp
parent12ec9b832fc74faba7162e54e04f7f48878ea88e (diff)
Combine lookupWitness lowering with specialization. (#2794)
Diffstat (limited to 'source/slang/slang-ir-lower-generic-function.cpp')
-rw-r--r--source/slang/slang-ir-lower-generic-function.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/source/slang/slang-ir-lower-generic-function.cpp b/source/slang/slang-ir-lower-generic-function.cpp
index e45b20563..12be27f07 100644
--- a/source/slang/slang-ir-lower-generic-function.cpp
+++ b/source/slang/slang-ir-lower-generic-function.cpp
@@ -28,14 +28,18 @@ namespace Slang
auto genericParent = as<IRGeneric>(genericValue);
SLANG_ASSERT(genericParent);
SLANG_ASSERT(genericParent->getDataType());
- auto func = as<IRFunc>(findGenericReturnVal(genericParent));
+ auto genericRetVal = findGenericReturnVal(genericParent);
+ auto func = as<IRFunc>(genericRetVal);
if (!func)
{
// Nested generic functions are supposed to be flattened before entering
// this pass. The reason we are still seeing them must be that they are
// intrinsic functions. In this case we ignore the function.
- SLANG_ASSERT(findInnerMostGenericReturnVal(genericParent)
- ->findDecoration<IRTargetIntrinsicDecoration>() != nullptr);
+ if (as<IRGeneric>(genericRetVal))
+ {
+ SLANG_ASSERT(findInnerMostGenericReturnVal(genericParent)
+ ->findDecoration<IRTargetIntrinsicDecoration>() != nullptr);
+ }
return genericValue;
}
SLANG_ASSERT(func);