Skip to content

Fix WebAssemblySpillPointers crash at O2: move pass before PEI#4

Merged
PLUTOFX merged 2 commits intorelease/16.xfrom
copilot/fix-frontend-compilation-error
Feb 28, 2026
Merged

Fix WebAssemblySpillPointers crash at O2: move pass before PEI#4
PLUTOFX merged 2 commits intorelease/16.xfrom
copilot/fix-frontend-compilation-error

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 28, 2026

WebAssemblySpillPointers crashes at O2 because it runs in addPreEmitPass() — after PEI has already completed. The pass creates new frame indices (CreateSpillStackObject + addFrameIndex) that PEI never resolves, and requires LiveIntervals that RegColoring has already invalidated.

Changes

  • Move pass from addPreEmitPass() to addPostRegAlloc() — runs before PEI, so frame indices are resolved normally
  • Remove addPreserved<LiveIntervals>() — the pass inserts STORE instructions, so claiming preservation was incorrect

Pipeline ordering (before → after)

Before:  ... → PEI → ... → RegColoring → SpillPointers(💥) → CFGSort
After:   ... → SpillPointers → PEI → ... → RegColoring → CFGSort

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…tRegAlloc

The SpillPointers pass was crashing at O2 because:
1. It created frame indices (via CreateSpillStackObject + addFrameIndex)
   in addPreEmitPass(), but PEI had already run and wouldn't resolve them
2. It required LiveIntervals after RegColoring had invalidated it

Fix: Move the pass to addPostRegAlloc() where it runs before PEI,
so frame indices are properly resolved. Also remove addPreserved
for LiveIntervals since the pass inserts new STORE instructions.

Co-authored-by: PLUTOFX <110596339+PLUTOFX@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix frontend compilation error with O2 optimization Fix WebAssemblySpillPointers crash at O2: move pass before PEI Feb 28, 2026
@PLUTOFX PLUTOFX marked this pull request as ready for review February 28, 2026 06:02
@PLUTOFX PLUTOFX merged commit b3db5a2 into release/16.x Feb 28, 2026
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.

2 participants