summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir-dce.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-ir-dce.cpp')
-rw-r--r--source/slang/slang-ir-dce.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/source/slang/slang-ir-dce.cpp b/source/slang/slang-ir-dce.cpp
index d58e307da..14edf21d7 100644
--- a/source/slang/slang-ir-dce.cpp
+++ b/source/slang/slang-ir-dce.cpp
@@ -305,6 +305,17 @@ bool shouldInstBeLiveIfParentIsLive(IRInst* inst, IRDeadCodeEliminationOptions o
{
return true;
}
+ if (inst->findDecoration<IRImportDecoration>())
+ {
+ if (inst->findDecoration<IRForwardDerivativeDecoration>())
+ return true;
+ if (auto genInst = as<IRGeneric>(inst))
+ {
+ auto inner = findInnerMostGenericReturnVal(genInst);
+ if (inner->findDecoration<IRForwardDerivativeDecoration>())
+ return true;
+ }
+ }
}
if (options.keepLayoutsAlive && inst->findDecoration<IRLayoutDecoration>())