summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang-ir-peephole.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/source/slang/slang-ir-peephole.cpp b/source/slang/slang-ir-peephole.cpp
index d7713618e..6cabbe8d4 100644
--- a/source/slang/slang-ir-peephole.cpp
+++ b/source/slang/slang-ir-peephole.cpp
@@ -845,8 +845,11 @@ struct PeepholeContext : InstPassBase
{
if (inst->hasUses())
{
- // Is argValue a global constant?
- if (isChildInstOf(inst, argValue->getParent()))
+ // Is argValue not a local value, i.e. it's not a child
+ // of a block, and it's 'visible' from inst because
+ // inst is a descendent of argValue's parent
+ if (!as<IRBlock>(argValue->getParent())
+ && isChildInstOf(inst, argValue->getParent()))
{
inst->replaceUsesWith(argValue);
// Never remove param inst.