summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-03-27 10:05:07 -0700
committerGitHub <noreply@github.com>2023-03-27 10:05:07 -0700
commit2179480e28bdd46c71cec269a8f55ba93aa54f53 (patch)
treef0b253c0b15956f3e60145b11e16aee6ef33fae1 /source
parent333968af7344bcf0ef77818d076efcf88acd159d (diff)
Fix lowering crash in [BackwardDerivativeOf]. (#2737)
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang-lower-to-ir.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/source/slang/slang-lower-to-ir.cpp b/source/slang/slang-lower-to-ir.cpp
index 9d424d1e8..6d4e50463 100644
--- a/source/slang/slang-lower-to-ir.cpp
+++ b/source/slang/slang-lower-to-ir.cpp
@@ -8088,7 +8088,7 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo>
return type->getOp() == kIROp_ClassType;
}
- LoweredValInfo lowerFuncDeclInContext(IRGenContext* subContext, IRBuilder* subBuilder, FunctionDeclBase* decl)
+ LoweredValInfo lowerFuncDeclInContext(IRGenContext* subContext, IRBuilder* subBuilder, FunctionDeclBase* decl, bool emitBody = true)
{
auto outerGeneric = emitOuterGenerics(subContext, decl, decl);
@@ -8156,7 +8156,7 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo>
// (although we might have to give in eventually), so
// this case should really only occur for builtin declarations.
}
- else
+ else if (emitBody)
{
// This is a function definition, so we need to actually
// construct IR for the body...
@@ -8610,7 +8610,7 @@ struct DeclLoweringVisitor : DeclVisitor<DeclLoweringVisitor, LoweredValInfo>
auto originalFuncDecl = as<FunctionDeclBase>(originalDeclRefExpr->declRef.getDecl());
SLANG_RELEASE_ASSERT(originalFuncDecl);
- auto originalFuncVal = lowerFuncDeclInContext(originalSubContext, originalSubBuilder, originalFuncDecl).val;
+ auto originalFuncVal = lowerFuncDeclInContext(originalSubContext, originalSubBuilder, originalFuncDecl, false).val;
if (auto originalFuncGeneric = as<IRGeneric>(originalFuncVal))
{
originalFuncVal = findGenericReturnVal(originalFuncGeneric);