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
{{ message }}
Repository navigation
JIT: (bug) jump threading deletes a PHI and rewrites its uses with an SSA def that does not reach all remaining predecessors #133981
optJumpThreadCore can delete a PHI in a join block and rewrite all of its uses with the SSA number from one ambiguous predecessor, even when another remaining predecessor reaches the block with a different reaching definition. Wrong code results.
r == false, so m/n keep their initial 0; q == false, so z == w == 0; control falls into T: and m == n holds.
Actual
101
101 is 100 + n with n == 1, the value n only has on the other (r == true) path. V07 (n) is zero-ref in the final codegen and folded to the constant 1.
Notes
Correct (200) under DOTNET_JITMinOpts=1 and on released .NET 10.0.12; deterministic on main under both default tiering and DOTNET_TieredCompilation=0.
Root cause: an earlier jump-thread in the same phase redirects an edge into the join block via fgReplaceJumpTarget, which updates the pred list but adds noGT_PHI_ARG for the new edge. optGetThreadedSsaNumForBlock / optGetThreadedSsaNumForSuccessor iterate only phi->Uses(), so that predecessor is invisible — even though the classification loop already printed "Could not map phi inputs from pred BB03" and added it to m_ambiguousPreds. They conclude all ambiguous preds agree, remove the PHI and rewrite the uses. Neither helper cross-checks the covered pred count against jti.m_numAmbiguousPreds. Introduced by #126907 (6323aecb949b).
changed the title [-]JIT (bug): jump threading deletes a PHI and rewrites its uses with an SSA def that does not reach all remaining predecessors[/-][+]JIT: (bug) jump threading deletes a PHI and rewrites its uses with an SSA def that does not reach all remaining predecessors[/+]on Sep 16, 2026
Activity
dotnet-policy-service commentedon Sep 15, 2026
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.
[-]JIT (bug): jump threading deletes a PHI and rewrites its uses with an SSA def that does not reach all remaining predecessors[/-][+]JIT: (bug) jump threading deletes a PHI and rewrites its uses with an SSA def that does not reach all remaining predecessors[/+]EgorBo commentedon Sep 18, 2026
Affected SDK versions:
JIT: Validate jump threading phi inputs (#134205)
[release/11.0] JIT: Validate jump threading phi inputs (#134348)