Skip to content

[asm] Handle PackOp inputs in regalloc liveness and linear scan#1144

Open
Hardcode84 wants to merge 1 commit intoiree-org:mainfrom
Hardcode84:waveasm-pack-regalloc
Open

[asm] Handle PackOp inputs in regalloc liveness and linear scan#1144
Hardcode84 wants to merge 1 commit intoiree-org:mainfrom
Hardcode84:waveasm-pack-regalloc

Conversation

@Hardcode84
Copy link
Contributor

@Hardcode84 Hardcode84 commented Mar 18, 2026

PackOp is a register allocation directive: its N inputs must form a contiguous register block matching the pack result. Previously, pack inputs got independent allocations to arbitrary registers while the result got a correct contiguous allocation, leaving downstream consumers reading uninitialized physical registers.

Fix by treating pack inputs as sub-registers of the pack result:

  • Liveness: extend the pack result's live range backwards to cover input defs, then remove inputs from allocation worklists.
  • LinearScanPass: post-pass assigns input[i].physReg = result + i, mirroring the existing ExtractOp post-pass.

This is prerequisite for properly handling SRD construction instead of using raw asm ops.

@Hardcode84 Hardcode84 changed the title Handle PackOp inputs in regalloc liveness and linear scan [asm] Handle PackOp inputs in regalloc liveness and linear scan Mar 18, 2026
PackOp is a register allocation directive: its N inputs must form a
contiguous register block matching the pack result. Previously, pack
inputs got independent allocations to arbitrary registers while the
result got a correct contiguous allocation, leaving downstream
consumers reading uninitialized physical registers.

Fix by treating pack inputs as sub-registers of the pack result:
- Liveness: extend the pack result's live range backwards to cover
  input defs, then remove inputs from allocation worklists.
- LinearScanPass: post-pass assigns input[i].physReg = result + i,
  mirroring the existing ExtractOp post-pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Ivan Butygin <ivan.butygin@gmail.com>
@Hardcode84 Hardcode84 force-pushed the waveasm-pack-regalloc branch from 8582ac3 to dbe05c6 Compare March 20, 2026 19:00
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