Skip to content

Commit c71b127

Browse files
authored
Fix Phi simplification bug (shader-slang#3325)
Fixes shader-slang#3323
1 parent 011d428 commit c71b127

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

source/slang/slang-ir-peephole.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -845,8 +845,11 @@ struct PeepholeContext : InstPassBase
845845
{
846846
if (inst->hasUses())
847847
{
848-
// Is argValue a global constant?
849-
if (isChildInstOf(inst, argValue->getParent()))
848+
// Is argValue not a local value, i.e. it's not a child
849+
// 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()))
850853
{
851854
inst->replaceUsesWith(argValue);
852855
// Never remove param inst.

0 commit comments

Comments
 (0)