summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang-ir-legalize-types.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/slang/slang-ir-legalize-types.cpp b/source/slang/slang-ir-legalize-types.cpp
index 91427ce9c..97571f117 100644
--- a/source/slang/slang-ir-legalize-types.cpp
+++ b/source/slang/slang-ir-legalize-types.cpp
@@ -2620,6 +2620,18 @@ struct IRTypeLegalizationPass
void processInst(IRInst* inst)
{
+ // It is possible that an insturction we
+ // encounterer during the legalization process
+ // will be one that was already removed or
+ // otherwise made redundant.
+ //
+ // We want to skip such instructions since there
+ // would not be a valid location at which to
+ // store their replacements.
+ //
+ if(!inst->getParent() && inst->op != kIROp_Module)
+ return;
+
// The main logic for legalizing an instruction is defined
// earlier in this file.
//