Skip to content

Avoid trimming spill ranges into deeper loops - #272

Open
wraitii wants to merge 1 commit into
bytecodealliance:mainfrom
wraitii:trim-loop-spill
Open

wraitii wants to merge 1 commit into
bytecodealliance:mainfrom
wraitii:trim-loop-spill

Conversation

@wraitii

@wraitii wraitii commented Nov 8, 2026

Copy link
Copy Markdown

Stop spill-range trimming when it would enter a deeper loop than the split point, on either side of the split. This prevents preservation around a call outside a loop from introducing unnecessary stores and reloads inside that loop.

See #271 for details. This PR was written by GPT-6 Astra, the fix looks reasonable to me but I can't say I have a deep understanding of this codebase. It's also a heuristic, as explained in the issue.

Validation that Astra ran:

  • All regalloc2 tests pass, plus 6,799 randomized allocation checks.
  • Both versions pass 1,399 Cranelift filetests and 1,196 checker-enabled files; existing assembly snapshots are unchanged.
  • Five targeted execution checks pass on both versions.
  • Sightglass: all 29 PCA workloads, 20 samples per engine on Apple ARM64. No statistically significant compilation or execution regression detected.

Stop spill-range trimming when it would enter a deeper loop than the split point. In general, this behaves badly if the last use is inside a loop, as it requires storing to the stack within the loop.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant