You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ir: Fix incorrect renaming of phinode values (#52614)
This fixes#52610. The underlying issue is a left over OldSSAValue after
the adce_pass! (introduced by compaction, it being during adce is
incidental). Compaction introduces `OldSSAValue` when it compacts in
PhiNodes that reference later SSAValues and adds them to a list to
revisit at the end of compaction to fill in the actual renamed result.
There are two separate fixes here:
1. If the result of the final revisit is yet another `OldSSAValue`,
rename it again. I don't this ordinarily happens at all, but I suppose
it is possible in theory during sroa beacuse of the rename-shortcut
optimization [1]. However, this is not not what happened here. Instead
compaction incorrectly used an OldSSAValue for an already-inserted node,
which then ends up in the rename list because we deleted one of the
predecessor edges [2]. To fix that we:
2. Fix an issue where we weren't accounting for the possibility of
previously pending nodes (which have SSAValues beyond the numbering
range of the ordinary statements) in the special already_inserted query
in phinode value processing. To fix this, unify the logic with the
ordinary `already_inserted` query, which handles this case correctly.
[1]
https://github.com/JuliaLang/julia/blob/9443c761871c4db9c3213a1e01804286292c3f4d/base/compiler/ssair/passes.jl#L1385
[2]
https://github.com/JuliaLang/julia/blob/9443c761871c4db9c3213a1e01804286292c3f4d/base/compiler/ssair/ir.jl#L1556
Co-authored-by: Tim Besard <[email protected]>
0 commit comments