diff options
author | Thomas Lively <tlively@google.com> | 2024-11-14 21:22:34 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-14 18:22:34 -0800 |
commit | 49c45ac1675d787e7151f9beafcae479936aa9f3 (patch) | |
tree | 1abb2ebffdb57d43e92615f4a166dc61532dbeef /test/lit/merge | |
parent | 6efd41779272d2ac7eb75705c21c9f437a1409c9 (diff) | |
download | binaryen-49c45ac1675d787e7151f9beafcae479936aa9f3.tar.gz binaryen-49c45ac1675d787e7151f9beafcae479936aa9f3.tar.bz2 binaryen-49c45ac1675d787e7151f9beafcae479936aa9f3.zip |
Use empty blocks instead of nops for empty scopes in IRBuilder (#7080)
When IRBuilder builds an empty non-block scope such as a function body,
an if arm, a try block, etc, it needs to produce some expression to
represent the empty contents. Previously it produced a nop, but change
it to produce an empty block instead. The binary writer and printer have
special logic to elide empty blocks, so this produces smaller output.
Update J2CLOpts to recognize functions containing empty blocks as
trivial to avoid regressing one of its tests.
Diffstat (limited to 'test/lit/merge')
-rw-r--r-- | test/lit/merge/chain.wat | 1 | ||||
-rw-r--r-- | test/lit/merge/names.wat | 6 | ||||
-rw-r--r-- | test/lit/merge/renamings.wat | 4 | ||||
-rw-r--r-- | test/lit/merge/table64.wat | 1 |
4 files changed, 0 insertions, 12 deletions
diff --git a/test/lit/merge/chain.wat b/test/lit/merge/chain.wat index 528b20d0e..9faca1143 100644 --- a/test/lit/merge/chain.wat +++ b/test/lit/merge/chain.wat @@ -16,7 +16,6 @@ ;; CHECK: (export "h" (func $0_2)) ;; CHECK: (func $0 (type $0) -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK: (func $0_2 (type $0) diff --git a/test/lit/merge/names.wat b/test/lit/merge/names.wat index 504dac102..6f51b54ca 100644 --- a/test/lit/merge/names.wat +++ b/test/lit/merge/names.wat @@ -89,7 +89,6 @@ ;; CHECK: (export "func2" (func $5)) ;; CHECK: (func $func0 (type $0) - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func0 (export "f0")) (func (export "f1")) @@ -117,21 +116,16 @@ (func (export "func") (param $x (ref $t))) ) ;; CHECK: (func $1 (type $0) -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK: (func $2 (type $3) (param $x (ref $t)) -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK: (func $func2 (type $0) -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK: (func $4 (type $0) -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK: (func $5 (type $4) (param $0 (ref $u)) -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) diff --git a/test/lit/merge/renamings.wat b/test/lit/merge/renamings.wat index 9c54f3514..e680b276b 100644 --- a/test/lit/merge/renamings.wat +++ b/test/lit/merge/renamings.wat @@ -141,7 +141,6 @@ ;; CHECK: (func $uses (type $3) (param $array (ref $array)) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $foo ;; CHECK-NEXT: (drop @@ -151,7 +150,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $bar ;; CHECK-NEXT: (drop @@ -323,7 +321,6 @@ ;; CHECK: (func $uses.second (type $3) (param $array (ref $array)) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $foo_2 ;; CHECK-NEXT: (drop @@ -333,7 +330,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $other ;; CHECK-NEXT: (drop diff --git a/test/lit/merge/table64.wat b/test/lit/merge/table64.wat index a313b5bc3..e1e41dca9 100644 --- a/test/lit/merge/table64.wat +++ b/test/lit/merge/table64.wat @@ -15,5 +15,4 @@ ;; CHECK: (export "table" (table $table)) ;; CHECK: (func $second (type $0) -;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) |