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) Tail duplication in fgUpdateFlowGraph does not terminate on a conditional cycle #134008
fgUpdateFlowGraph can endlessly rotate one unconditional edge around a cycle of simple conditional blocks. The JIT hangs in "Optimize control flow" and allocates memory without bound.
start
<hangs forever, 100% of one core, memory grows without bound>
Measured on a Checked x64 build:
STILL RUNNING after 90s. PID=123416 CPU=89.73 WS=44684.6MB
After 5 more s: CPU=94.72 WS=45296.5MB
With JitDump, the last phase repeats the same tail-duplication cycle indefinitely:
fgOptimizeUncondBranchToSimpleCond(from BB07 to cond BB12), modified BB07
fgOptimizeUncondBranchToSimpleCond(from BB07 to cond BB08), modified BB07
fgOptimizeUncondBranchToSimpleCond(from BB07 to cond BB10), modified BB07
Notes
Compiler::fgUpdateFlowGraph() (fgopt.cpp) has no duplication budget or visited (source,target) set; fgBlockIsGoodTailDuplicationCandidate() rejects direct self-edges but not multi-block conditional cycles. fgFoldSimpleCondByForwardSub() folds the cloned test while leaving the constant store, so the source block remains a tail-dup candidate for the next edge.
Also reproduces on released .NET 10.0.12 x64. A bounded budget or per-invocation duplicate-pair tracking would break the cycle.
changed the title [-]JIT (bug): Tail duplication in fgUpdateFlowGraph does not terminate on a conditional cycle[/-][+]JIT: (bug) Tail duplication in fgUpdateFlowGraph does not terminate on a conditional cycle[/+]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): Tail duplication in fgUpdateFlowGraph does not terminate on a conditional cycle[/-][+]JIT: (bug) Tail duplication in fgUpdateFlowGraph does not terminate on a conditional cycle[/+]JIT: stop tail duplication from looping forever around a conditional … (