GitHub Issue: Another RyuJIT optimization bug #1299dotnet#1299
The underlying problem is there are two loops:
The first loop does copy prop
The second loop updates the stack of live definitions in the currently
traversed CFG path.
This approach works fine only if assignments are atomic statements, but
when there is an assignment embedded using a comma in a statement:
The first loop does nothing about this and continues to propagate
copies, i.e., without updating the liveness stack. This leads to using a
stale VN for comparison rather than using an updated VN due to this
Only when the second loop runs, this live definition is added to the
The right fix is to merge the two loops into a single loop that does
copy prop on the tree and at the same time updates the liveness on the
stack right after the call. But this is causing a lot of ASM diffs which
would affect stability.
I am making a conservative fix of temporarily marking the variables that
have embedded intervening defs as "killed", until the second loop runs
to update liveness.
There are no SuperASM diffs with this change.