summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/passes/remove-unused-brs_enable-multivalue.txt103
-rw-r--r--test/passes/remove-unused-brs_enable-multivalue.wast87
2 files changed, 190 insertions, 0 deletions
diff --git a/test/passes/remove-unused-brs_enable-multivalue.txt b/test/passes/remove-unused-brs_enable-multivalue.txt
index 29b5eca5e..46938f784 100644
--- a/test/passes/remove-unused-brs_enable-multivalue.txt
+++ b/test/passes/remove-unused-brs_enable-multivalue.txt
@@ -1669,6 +1669,109 @@
)
(unreachable)
)
+ (func $br-to-table-initial-tee (param $a i32)
+ (block $x
+ (block $y
+ (block $z
+ (nop)
+ (nop)
+ (block $tablify|0
+ (br_table $x $y $z $tablify|0
+ (i32.sub
+ (local.tee $a
+ (i32.add
+ (i32.const 10)
+ (i32.const 1)
+ )
+ )
+ (i32.const 10)
+ )
+ )
+ )
+ (unreachable)
+ )
+ (unreachable)
+ )
+ (unreachable)
+ )
+ (unreachable)
+ )
+ (func $br-to-table-initial-tee-wrong-index (param $a i32)
+ (local $b i32)
+ (block $x
+ (block $y
+ (block $z
+ (br_if $x
+ (i32.eq
+ (local.tee $a
+ (i32.const 99)
+ )
+ (i32.const 10)
+ )
+ )
+ (br_if $y
+ (i32.eq
+ (local.get $b)
+ (i32.const 11)
+ )
+ )
+ (br_if $z
+ (i32.eq
+ (local.get $b)
+ (i32.const 12)
+ )
+ )
+ (unreachable)
+ )
+ (unreachable)
+ )
+ (unreachable)
+ )
+ (unreachable)
+ )
+ (func $br-to-table-eqz (param $a i32)
+ (block $x
+ (block $y
+ (block $z
+ (nop)
+ (nop)
+ (block $tablify|0
+ (br_table $x $y $z $tablify|0
+ (local.get $a)
+ )
+ )
+ (unreachable)
+ )
+ (unreachable)
+ )
+ (unreachable)
+ )
+ (unreachable)
+ )
+ (func $br-to-table-tee-eqz (param $a i32)
+ (block $x
+ (block $y
+ (block $z
+ (nop)
+ (nop)
+ (block $tablify|0
+ (br_table $x $y $z $tablify|0
+ (local.tee $a
+ (i32.add
+ (i32.const 0)
+ (i32.const 1)
+ )
+ )
+ )
+ )
+ (unreachable)
+ )
+ (unreachable)
+ )
+ (unreachable)
+ )
+ (unreachable)
+ )
(func $tiny-switch
(if
(i32.const 0)
diff --git a/test/passes/remove-unused-brs_enable-multivalue.wast b/test/passes/remove-unused-brs_enable-multivalue.wast
index afc8c3836..ae8878e00 100644
--- a/test/passes/remove-unused-brs_enable-multivalue.wast
+++ b/test/passes/remove-unused-brs_enable-multivalue.wast
@@ -1353,6 +1353,93 @@
)
(unreachable)
)
+ (func $br-to-table-initial-tee (param $a i32)
+ (block $x
+ (block $y
+ (block $z
+ (br_if $x
+ (i32.eq
+ (local.tee $a
+ (i32.add
+ (i32.const 10)
+ (i32.const 1)
+ )
+ )
+ (i32.const 10)
+ )
+ )
+ (br_if $y (i32.eq (local.get $a) (i32.const 11)))
+ (br_if $z (i32.eq (local.get $a) (i32.const 12)))
+ (unreachable)
+ )
+ (unreachable)
+ )
+ (unreachable)
+ )
+ (unreachable)
+ )
+ (func $br-to-table-initial-tee-wrong-index (param $a i32)
+ (local $b i32)
+ (block $x
+ (block $y
+ (block $z
+ (br_if $x
+ (i32.eq
+ (local.tee $a (i32.const 99))
+ (i32.const 10)
+ )
+ )
+ ;; The subsequent conditions use a different local, $b, so we cannot
+ ;; optimize here.
+ (br_if $y (i32.eq (local.get $b) (i32.const 11)))
+ (br_if $z (i32.eq (local.get $b) (i32.const 12)))
+ (unreachable)
+ )
+ (unreachable)
+ )
+ (unreachable)
+ )
+ (unreachable)
+ )
+ (func $br-to-table-eqz (param $a i32)
+ (block $x
+ (block $y
+ (block $z
+ (br_if $x (i32.eqz (local.get $a)))
+ (br_if $y (i32.eq (local.get $a) (i32.const 1)))
+ (br_if $z (i32.eq (local.get $a) (i32.const 2)))
+ (unreachable)
+ )
+ (unreachable)
+ )
+ (unreachable)
+ )
+ (unreachable)
+ )
+ (func $br-to-table-tee-eqz (param $a i32)
+ (block $x
+ (block $y
+ (block $z
+ (br_if $x
+ (i32.eqz
+ (local.tee $a
+ (i32.add
+ (i32.const 0)
+ (i32.const 1)
+ )
+ )
+ )
+ )
+ (br_if $y (i32.eq (local.get $a) (i32.const 1)))
+ (br_if $z (i32.eq (local.get $a) (i32.const 2)))
+ (unreachable)
+ )
+ (unreachable)
+ )
+ (unreachable)
+ )
+ (unreachable)
+ )
(func $tiny-switch
(block $x
(block $y