summaryrefslogtreecommitdiff
path: root/test/lit/passes
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2024-04-29 13:17:14 -0700
committerGitHub <noreply@github.com>2024-04-29 13:17:14 -0700
commitbe001f7e214c31ee1d7864a7081634b8986d72bf (patch)
tree87a7d609cffbb86b72b05d9cca881cce697dfa2c /test/lit/passes
parentdcc5b7ba0149a85d2784520c262b83df488705f5 (diff)
downloadbinaryen-be001f7e214c31ee1d7864a7081634b8986d72bf.tar.gz
binaryen-be001f7e214c31ee1d7864a7081634b8986d72bf.tar.bz2
binaryen-be001f7e214c31ee1d7864a7081634b8986d72bf.zip
[Parser] Re-use blocks instead of wrapping where possible (#6552)
When the input has branches to block scope, IR builder generally has to add a wrapper block with a label name for the branch to target. To reduce the parsed IR size, add a special case for when the wrapped expression is already an unnamed block. In that case we can simply add the label to the existing block instead of creating a new wrapper block.
Diffstat (limited to 'test/lit/passes')
-rw-r--r--test/lit/passes/type-merging-tnh.wast22
-rw-r--r--test/lit/passes/type-merging.wast22
2 files changed, 20 insertions, 24 deletions
diff --git a/test/lit/passes/type-merging-tnh.wast b/test/lit/passes/type-merging-tnh.wast
index efa82c924..ee0603fa6 100644
--- a/test/lit/passes/type-merging-tnh.wast
+++ b/test/lit/passes/type-merging-tnh.wast
@@ -56,22 +56,20 @@
;; CHECK: (func $test (type $2) (param $a (ref $A)) (result (ref $B))
;; CHECK-NEXT: (block $label (result (ref $B))
- ;; CHECK-NEXT: (block (result (ref $B))
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (br_on_cast $label (ref $A) (ref $B)
- ;; CHECK-NEXT: (local.get $a)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (br_on_cast $label (ref $A) (ref $B)
+ ;; CHECK-NEXT: (local.get $a)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (block $l (result (ref $A))
- ;; CHECK-NEXT: (br_on_non_null $l
- ;; CHECK-NEXT: (local.get $a)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (unreachable)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (block $l (result (ref $A))
+ ;; CHECK-NEXT: (br_on_non_null $l
+ ;; CHECK-NEXT: (local.get $a)
;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $test (param $a (ref $A)) (result (ref $B))
diff --git a/test/lit/passes/type-merging.wast b/test/lit/passes/type-merging.wast
index 734c0197a..b9fcd9c01 100644
--- a/test/lit/passes/type-merging.wast
+++ b/test/lit/passes/type-merging.wast
@@ -1053,22 +1053,20 @@
;; CHECK: (func $test (type $2) (param $a (ref $A)) (result (ref $B))
;; CHECK-NEXT: (block $label (result (ref $B))
- ;; CHECK-NEXT: (block (result (ref $B))
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (br_on_cast $label (ref $A) (ref $B)
- ;; CHECK-NEXT: (local.get $a)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (br_on_cast $label (ref $A) (ref $B)
+ ;; CHECK-NEXT: (local.get $a)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (block $l (result (ref $A))
- ;; CHECK-NEXT: (br_on_non_null $l
- ;; CHECK-NEXT: (local.get $a)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (unreachable)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (block $l (result (ref $A))
+ ;; CHECK-NEXT: (br_on_non_null $l
+ ;; CHECK-NEXT: (local.get $a)
;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $test (param $a (ref $A)) (result (ref $B))