Skip to content

MergeBlocks: Migrate from invalidates to orderedBefore - #8767

Merged
tlively merged 3 commits into
mainfrom
merge-blocks-ordered-effects
May 26, 2026
Merged

MergeBlocks: Migrate from invalidates to orderedBefore#8767
tlively merged 3 commits into
mainfrom
merge-blocks-ordered-effects

Conversation

@tlively

@tlively tlively commented May 23, 2026

Copy link
Copy Markdown
Member

Replace the coarse 'invalidates' check in 'MergeBlocks' with 'orderedBefore'. This allows 'MergeBlocks' to move expressions (like GC reads) out of blocks past other sibling expressions that have been left behind.

Also clean up dead code in 'optimize()' by removing the unused 'dependency1' and 'dependency2' parameters and their checks (which were the other two replaced 'invalidates' calls that are no longer active).

TAG=agy

Replace the coarse 'invalidates' check in 'MergeBlocks' with 'orderedBefore'. This allows 'MergeBlocks' to move expressions (like GC reads) out of blocks past other sibling expressions that have been left behind.

Also clean up dead code in 'optimize()' by removing the unused 'dependency1' and 'dependency2' parameters and their checks (which were the other two replaced 'invalidates' calls that are no longer active).

TAG=agy
@tlively
tlively requested a review from a team as a code owner May 23, 2026 00:49
@tlively
tlively requested review from aheejin and removed request for a team May 23, 2026 00:49
Comment on lines +15 to +17
;; Test 1: Disallowed reordering (GC read NOT moved before Wasm acquire load)
;; Child 0 is named, so it is NOT optimized and its effects (acquire load) are left behind.
;; Child 1 tries to move the GC read out, which should be blocked because it cannot move before the acquire load.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

NIt: Comment 80-col wrapping. The same for Test 2

@tlively
tlively enabled auto-merge (squash) May 26, 2026 15:43
@tlively
tlively disabled auto-merge May 26, 2026 15:48
@tlively
tlively merged commit d78dba3 into main May 26, 2026
4 of 16 checks passed
@tlively
tlively deleted the merge-blocks-ordered-effects branch May 26, 2026 15:48
@kripken

kripken commented May 26, 2026

Copy link
Copy Markdown
Member

@tlively The new lit test here is failing on main somehow:

Failed Tests (1):
  Binaryen lit tests :: passes/merge-blocks-atomics.wast

e.g. https://github.com/WebAssembly/binaryen/actions/runs/26468274003/job/77934377247

@tlively

tlively commented May 26, 2026

Copy link
Copy Markdown
Member Author

Yep, my bad. I'll have a fix up in a few. The test output just needs to be updated.

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.

3 participants