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
[Wasm][CoreCLR] Loop-hoisting profitability uses a negative native-register budget #135979
Revision 29d644d27d095059a3098156166e0dc4f9d513ed; browser wasm32 CoreCLR ReadyToRun, Release with --optimize, symbols retained. Checked cross-JIT used separately for diagnostics, with the same compilation inputs and --parallelism:1 --codegenopt:JitDump=*.
Regression?
Not established; observed optimization gap.
Data
The delivered 66-byte Wasm body retains scale + 3 inside the loop:
[000012] hoistable
tree cost too low: 3 < 6 (loopVarCount 4 >= availRegCount 4294967294)
... not profitable to hoist
Analysis
optimizer.cpp computes CNT_CALLEE_SAVED - 1, plus CNT_CALLEE_TRASH - 1 for a call-free loop. targetwasm.h defines both counts as zero, while providing separate nonzero *_FOR_CSE estimates. The signed budget is -2, displayed unsigned in the diagnostic; the profitability check consequently treats the loop as register-constrained.
Consider adapting the heuristic to Wasm virtual locals and auditing related native-register-budget consumers. Preserve zero-trip/overflow semantics and validate with a loop that cannot be eliminated entirely. No isolated speedup has been measured: Mono eliminates this synthetic loop, so its comparative timing cannot quantify the missed hoist.
Note
This issue was prepared by GitHub Copilot from a locally executed codegen comparison study.
Activity
dotnet-policy-service commentedon Oct 16, 2026
Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara
See info in area-owners.md if you want to be subscribed.
dotnet-policy-service commentedon Oct 16, 2026
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.
kotlarmilos commentedon Oct 19, 2026
@adamperlin Can I assign you to this issue?
adamperlin commentedon Oct 19, 2026
Thanks for asking, I just assigned it to myself!