fix(Heap2Local): Track RMW results to handle nested flows (#8850) - #9081
Open
ArkadySkv wants to merge 1 commit into
Open
fix(Heap2Local): Track RMW results to handle nested flows (#8850)#9081ArkadySkv wants to merge 1 commit into
ArkadySkv wants to merge 1 commit into
Conversation
…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
requested review from
stevenfontanella
and removed request for
a team
September 7, 2026 11:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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) andextends
EscapeAnalyzer,visitStructRMW, andvisitStructCmpxchgto handle nested flows.
Tested with:
heap2local-rmw.wastlit testAll tests pass (4 d8-related failures are unrelated and due to local
environment).
Fixes #8850.