Skip to content

[Heap2Local] Refinalize when cmpxchg-to-get rewrite refines type - #9270

Open
tlively wants to merge 1 commit into
mainfrom
heap2local-cmpxchg-refinalize
Open

tlively wants to merge 1 commit into
mainfrom
heap2local-cmpxchg-refinalize

Conversation

@tlively

@tlively tlively commented Oct 16, 2026

Copy link
Copy Markdown
Member

When a non-escaping allocation flows into the expected operand of a struct.atomic.rmw.cmpxchg or array.atomic.rmw.cmpxchg, Struct2Local rewrites the cmpxchg into a block ending with a struct.atomic.get or array.atomic.get on a scratch local holding curr->ref. When curr->ref has a null reference type, the original cmpxchg takes its result type from curr->replacement, whereas the replacement struct.get or array.get refines its result type to (ref none). Refinalize to propagate the refined type when this happens.

When a non-escaping allocation flows into the `expected` operand of a `struct.atomic.rmw.cmpxchg` or `array.atomic.rmw.cmpxchg`, `Struct2Local` rewrites the cmpxchg into a block ending with a `struct.atomic.get` or `array.atomic.get` on a scratch local holding `curr->ref`. When `curr->ref` has a null reference type, the original cmpxchg takes its result type from `curr->replacement`, whereas the replacement `struct.get` or `array.get` refines its result type to `(ref none)`. Refinalize to propagate the refined type when this happens.
@tlively
tlively requested a review from a team as a code owner October 16, 2026 19:19
@tlively
tlively requested review from stevenfontanella and removed request for a team October 16, 2026 19:19

This branch has not been deployed

No deployments
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