Fix a bug in SSA form creation (#1058)
Fix a bug in SSA form creation (#1058)

It was possible for a recursive call to `tryRemoveTriviailPhi` to remove/replace a phi node that was already in a list of removal candidates to be processed. When the recursive call returned and that candidate was again considered, its operands would have already been cleared, leading to an assertion failure.

This case is what was coming up in practice in a user shader, although I have not been able to reproduce the failure with a more minimal synthetic test yet.

This change also changes the SSA creation logic to avoid a runtime crash in the case of a trivial phi that only references itself (which was how the above bug surfaced to the user). The "fix" there is not ideal (it leaves a trivial phi behind), but should be enough to retain semantic correctness if user code ever causes that (corneer-case) code path to execute. It is also expected that such a trivial phi would be removed in later DCE passes anyway.
shader-slang/slang,shader-slang/slang,csyonghe/slang,csyonghe/slang,csyonghe/slang,shader-slang/slang