Skip to content

[Heap2Local2] Support struct and array cmpxchg - #9415

Open
tlively wants to merge 1 commit into
mainfrom
heap2local2-cmpxchg
Open

tlively wants to merge 1 commit into
mainfrom
heap2local2-cmpxchg

Conversation

@tlively

@tlively tlively commented Nov 21, 2026

Copy link
Copy Markdown
Member

Model struct.atomic.rmw.cmpxchg and array.atomic.rmw.cmpxchg in Heap2Local2 by linking expected and replacement origins as conditional escape edges (so replacement only escapes if expected can match a heap value at runtime) and lowering cmpxchg operations on non-escaping allocations or non-matching expected operands in Optimizer.

Model struct.atomic.rmw.cmpxchg and array.atomic.rmw.cmpxchg in Heap2Local2 by linking expected and replacement origins as conditional escape edges (so replacement only escapes if expected can match a heap value at runtime) and lowering cmpxchg operations on non-escaping allocations or non-matching expected operands in Optimizer.
@tlively
tlively requested a review from kripken November 21, 2026 03:22
std::vector<NodeId> escapingNodes;
// Tracked cmpxchg sites where an escaping expected value forces replacement
// to escape.
std::vector<CmpxchgSite> cmpxchgSites;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't fold the cmpxchg edges into the normal graph like we did for cast edges because they are not dataflow edges at all and would have to be special-cased everywhere anyway.

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