diff options
Diffstat (limited to 'source/slang/emit.cpp')
| -rw-r--r-- | source/slang/emit.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp index 84585f248..f17b13762 100644 --- a/source/slang/emit.cpp +++ b/source/slang/emit.cpp @@ -2393,6 +2393,7 @@ struct EmitVisitor case kIROp_GlobalConstant: case kIROp_GlobalParam: case kIROp_Param: + case kIROp_Func: return false; // Always fold these in, because they are trivial @@ -2513,6 +2514,15 @@ struct EmitVisitor } } + // If the instruction is at global scope, then it might represent + // a constant (e.g., the value of an enum case). + // + if(as<IRModuleInst>(inst->getParent())) + { + if(!inst->mightHaveSideEffects()) + return true; + } + // Having dealt with all of the cases where we *must* fold things // above, we can now deal with the more general cases where we // *should not* fold things. |
