diff options
author | Alon Zakai <azakai@google.com> | 2021-09-09 17:12:37 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-09 17:12:37 -0700 |
commit | 23e452a5c89cc520a1d08bb465785bcb79a43baa (patch) | |
tree | da42099b51c302a097132dd8d2e64e750f797081 /test | |
parent | 7ecc77a11a7844e4b8142fad0a718d4f8f4d193b (diff) | |
download | binaryen-23e452a5c89cc520a1d08bb465785bcb79a43baa.tar.gz binaryen-23e452a5c89cc520a1d08bb465785bcb79a43baa.tar.bz2 binaryen-23e452a5c89cc520a1d08bb465785bcb79a43baa.zip |
Refactor MergeBlocks to use iteration; adds Wasm GC support (#4137)
MergeBlocks was written a very long time ago, before the
iteration API, so it had a bunch of hardcoded things for
specific instructions. In particular, that did not handle GC.
This does a small refactoring to use iteration. The refactoring
is NFC, but while doing so it adds support for new relevant
instructions, including wasm GC.
Diffstat (limited to 'test')
-rw-r--r-- | test/lit/passes/merge-blocks.wast | 61 |
1 files changed, 60 insertions, 1 deletions
diff --git a/test/lit/passes/merge-blocks.wast b/test/lit/passes/merge-blocks.wast index 10d6b1d71..89eab22ae 100644 --- a/test/lit/passes/merge-blocks.wast +++ b/test/lit/passes/merge-blocks.wast @@ -1,9 +1,16 @@ ;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. -;; RUN: wasm-opt %s --merge-blocks -all -S -o - \ +;; RUN: wasm-opt %s --remove-unused-names --merge-blocks -all -S -o - \ ;; RUN: | filecheck %s +;; +;; --remove-unused-names lets --merge-blocks assume blocks without names have no +;; branch targets. (module (type $anyref_=>_none (func (param anyref))) + + ;; CHECK: (type $struct (struct (field (mut i32)))) + (type $struct (struct (field (mut i32)))) + ;; CHECK: (func $br_on_to_drop ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: (drop @@ -31,4 +38,56 @@ ) ) ) + + ;; CHECK: (func $struct.set + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.const 1234) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (struct.set $struct 0 + ;; CHECK-NEXT: (ref.null $struct) + ;; CHECK-NEXT: (i32.const 5) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: ) + (func $struct.set + (block + (nop) + (struct.set $struct 0 + (block (result (ref null $struct)) + (drop (i32.const 1234)) + (ref.null $struct) + ) + (i32.const 5) + ) + (nop) + ) + ) + + ;; CHECK: (func $struct.get + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.const 1234) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (struct.get $struct 0 + ;; CHECK-NEXT: (ref.null $struct) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: ) + (func $struct.get + (block + (nop) + (drop + (struct.get $struct 0 + (block (result (ref null $struct)) + (drop (i32.const 1234)) + (ref.null $struct) + ) + ) + ) + (nop) + ) + ) ) |