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) folding a constant switch with a shared case target zeroes the target's profile weight ("Inconsistent profile data" assert) #134896
When morph folds a constant BBJ_SWITCH and the taken case shares its FlowEdge with another case, the target's weight is subtracted twice, leaving the only live block with weight 0.
Assertion failed '!"Inconsistent profile data"' in 'Program:Test(int):int' during 'Morph - Global' (IL size 42; hash 0x5b844c46; FullOpts)
File: src\coreclr\jit\fgprofile.cpp:4924
Regression?
The assert only fires on Checked builds, so release builds of .NET 8 through 11 RC2 print 5. Based on source history, the faulty weight update has existed since .NET 10 (845dc11).
Notes
In fgFoldConditional (BBJ_SWITCH), decreaseBBProfileWeight(curEdge->getLikelyWeight()) runs once per jump-table slot. For the second slot of a shared edge, the retained edge's likelihood was already set to 1.0, so the full block weight is subtracted from the target.
The target is BBJ_RETURN, so profileInconsistent isn't set. On release builds the result is silently wrong profile data (whole method treated as run-rarely).
Activity
dotnet-policy-service commentedon Sep 29, 2026
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.
JIT: fix profile update when folding a switch with shared case targets (