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) PHI-based jump threading leaves stale VNs on the parents of rewritten PHI uses, so CSE reuses a value from a different SSA def #135813
After SSA-aware PHI jump threading, optJumpThreadCore updates the VN of the rewritten LCL_VAR use but not of its parents. Trees that read different SSA defs of a loop-carried variable end up with identical VNs, and Optimize Valnum CSEs reuses a value from the wrong def, producing a wrong result.
1021 (= v0 * a + v2: the first iteration's x * a is reused in the second one). The loop body disassembles to v2 + (v0 * a) and v1 is unused.
Regression?
Yes, a regression in .NET 11: 8.0.x, 9.0.x and 10.0.12 print 1035; 11.0.0-rc.1 and current main print 1021. Likely introduced by #126812 (SSA-aware PHI jump threading, re-enabled in #127103).
Notes
DOTNET_JitDoRedundantBranchOpts=0 and DOTNET_JITMinOpts=1 both print 1035.
JitDump: Updating [000038] VN from $102 {PhiDef(V07 d:3, u:4, u:2)} to $80 {InitVal($40)}. Only the LCL_VAR leaf is updated; its MUL/ADD parents keep VNs derived from PhiDef(x.3) ($141/$146 in both blocks).
The fix-up in optJumpThreadCore (redundantbranchopts.cpp, after use->SetVNs(newVNPair)) only walks GT_COMMA parents. All ancestors need renumbering/invalidation, or CSE must be blocked for rewritten trees.
Activity
dotnet-policy-service commentedon Oct 14, 2026
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.
JIT: rebuild SSA and VN after RBO jump threading (#137972)