We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 011d428 commit c71b127Copy full SHA for c71b127
source/slang/slang-ir-peephole.cpp
@@ -845,8 +845,11 @@ struct PeepholeContext : InstPassBase
845
{
846
if (inst->hasUses())
847
848
- // Is argValue a global constant?
849
- 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
850
+ // inst is a descendent of argValue's parent
851
+ if (!as<IRBlock>(argValue->getParent())
852
+ && isChildInstOf(inst, argValue->getParent()))
853
854
inst->replaceUsesWith(argValue);
855
// Never remove param inst.
0 commit comments