Fix lost copy on shader SSA deconstruction

This commit is contained in:
Gabriel A 2024-03-10 18:05:12 -03:00
commit 34e2657a1f

View file

@ -24,17 +24,21 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
continue; continue;
} }
Operand temp = OperandHelper.Local();
for (int index = 0; index < phi.SourcesCount; index++) for (int index = 0; index < phi.SourcesCount; index++)
{ {
Operand src = phi.GetSource(index); Operand src = phi.GetSource(index);
BasicBlock srcBlock = phi.GetBlock(index); BasicBlock srcBlock = phi.GetBlock(index);
Operation copyOp = new(Instruction.Copy, phi.Dest, src); Operation copyOp = new(Instruction.Copy, temp, src);
srcBlock.Append(copyOp); srcBlock.Append(copyOp);
} }
Operation copyOp2 = new(Instruction.Copy, phi.Dest, temp);
nextNode = block.Operations.AddAfter(node, copyOp2).Next;
block.Operations.Remove(node); block.Operations.Remove(node);
node = nextNode; node = nextNode;