diff options
Diffstat (limited to 'source/slang/slang-ir-explicit-global-context.cpp')
| -rw-r--r-- | source/slang/slang-ir-explicit-global-context.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source/slang/slang-ir-explicit-global-context.cpp b/source/slang/slang-ir-explicit-global-context.cpp index f235ba3e4..9fae4ce15 100644 --- a/source/slang/slang-ir-explicit-global-context.cpp +++ b/source/slang/slang-ir-explicit-global-context.cpp @@ -661,6 +661,12 @@ struct IntroduceExplicitGlobalContextPass ptr = builder.emitLoad(ptr); use->set(ptr); } + + // We've replaced all uses of the global var so we should remove it. + // We leave decorations on the global var above, so if we do not remove it + // here, the global var will not be processed for elimination in + // eliminateDeadCode. + globalVar->removeAndDeallocate(); } IRInst* findOrCreateContextPtrForInst(IRInst* inst) |
