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) OSR patchpoint is not placed for a loop whose backedge-source block has a non-empty IL stack (e.g. while (i < (flag ? a : b))), so the loop stays in Tier0 (~100x slower) #135818
When the backedge-source block has a non-empty IL stack, the importer should fall back to placing the patchpoint at the backedge target, but the fallback is guarded by an inverted condition and never fires. Such loops get no patchpoint and run in (instrumented) Tier0 for their whole lifetime.
Test gets a Tier1-OSR version like Control; both loops take about the same time.
Actual
Control: 188 ms
Test: 22788 ms (20512 ms in another run)
DOTNET_JitDisasmSummary=1 lists Control with Tier1-OSR @0x10, but Test only as Instrumented Tier0; the JitDump of Test shows -- 0 patchpoints transformed.
Regression?
Also reproduces on .NET 10 (no Tier1-OSR for Test); not re-verified.
Notes
impImportBlockCode (importer.cpp, default TC_PatchpointStrategy, mustUseTargetPatchpoint path) has if (succBlock->HasFlag(BBF_OSR_PATCHPOINT)) guarding code that setsBBF_OSR_PATCHPOINT; the comment above it says "If not, add one", so the condition should be !HasFlag.
As written, the branch can only set an already-set flag. The loop head has bbRefs == 1, so no other path places a patchpoint there.
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.