Skip to content

fix(Heap2Local): Track RMW results to handle nested flows (#8850) - #9081

Open
ArkadySkv wants to merge 1 commit into
WebAssembly:mainfrom
ArkadySkv:fix-heap2local-rmw-tracking-8850
Open

fix(Heap2Local): Track RMW results to handle nested flows (#8850)#9081
ArkadySkv wants to merge 1 commit into
WebAssembly:mainfrom
ArkadySkv:fix-heap2local-rmw-tracking-8850

Conversation

@ArkadySkv

Copy link
Copy Markdown

This PR fixes a bug in Heap2Local where nested atomic RMW operations
were incorrectly optimized.

When an inner cmpxchg result flows into the value operand of an outer
xchg, the pass now correctly tracks this data flow and preserves the
RMW operations while localizing their ref operands.

The fix adds RMW result tracking infrastructure (RMWResultInfo) and
extends EscapeAnalyzer, visitStructRMW, and visitStructCmpxchg
to handle nested flows.

Tested with:

All tests pass (4 d8-related failures are unrelated and due to local
environment).

Fixes #8850.

…y#8850)

Add RMW result tracking infrastructure to handle cases where an inner
cmpxchg result flows into the value operand of an outer xchg.

- Add RMWResultInfo struct and RMWResultInfoMap
- Extend EscapeAnalyzer to follow RMW result flows
- Modify visitStructRMW and visitStructCmpxchg to detect nested flows
- Store reference-typed RMW results in scratch locals for downstream use

Fixes WebAssembly#8850.
@ArkadySkv
ArkadySkv requested a review from a team as a code owner September 7, 2026 11:22
@ArkadySkv
ArkadySkv requested review from stevenfontanella and removed request for a team September 7, 2026 11:22
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.

Heap2Local bug on cmpxchng

1 participant