summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/br_table_temp.2asm.js10
-rw-r--r--test/merge/basics.wast.combined.finalized.opt2
-rw-r--r--test/passes/flatten-control-flow.txt7
-rw-r--r--test/passes/flatten-control-flow.wast7
-rw-r--r--test/passes/merge-blocks.txt14
-rw-r--r--test/passes/merge-blocks.wast14
-rw-r--r--test/passes/optimize-instructions.txt9
-rw-r--r--test/passes/optimize-instructions_optimize-level=2_ignore-implicit-traps.txt38
-rw-r--r--test/passes/optimize-instructions_optimize-level=2_ignore-implicit-traps.wast38
-rw-r--r--test/passes/precompute.txt32
-rw-r--r--test/passes/precompute.wast31
-rw-r--r--test/passes/remove-unused-brs.txt44
-rw-r--r--test/passes/remove-unused-brs.wast41
-rw-r--r--test/passes/remove-unused-names.txt10
-rw-r--r--test/passes/remove-unused-names.wast4
-rw-r--r--test/passes/remove-unused-names_merge-blocks.txt8
-rw-r--r--test/passes/remove-unused-names_merge-blocks.wast12
-rw-r--r--test/passes/simplify-locals.txt18
-rw-r--r--test/passes/vacuum.txt13
-rw-r--r--test/passes/vacuum.wast19
-rw-r--r--test/polymorphic_stack.wast22
-rw-r--r--test/polymorphic_stack.wast.from-wast20
-rw-r--r--test/polymorphic_stack.wast.fromBinary23
-rw-r--r--test/polymorphic_stack.wast.fromBinary.noDebugInfo23
m---------test/spec0
-rw-r--r--test/unit.wast4
-rw-r--r--test/unit.wast.from-wast4
-rw-r--r--test/untaken-br_if.wast6
-rw-r--r--test/untaken-br_if.wast.from-wast6
-rw-r--r--test/untaken-br_if.wast.fromBinary10
-rw-r--r--test/untaken-br_if.wast.fromBinary.noDebugInfo10
31 files changed, 378 insertions, 121 deletions
diff --git a/test/br_table_temp.2asm.js b/test/br_table_temp.2asm.js
index 19fd67368..eb513b071 100644
--- a/test/br_table_temp.2asm.js
+++ b/test/br_table_temp.2asm.js
@@ -49531,7 +49531,7 @@ function asmFunc(global, env, buffer) {
}
function $$20() {
- var $$0 = 0, $$1 = 0;
+ var $$0 = 0, $$1 = 0, $$2 = 0, $$3 = 0;
fake_return_waka123 : {
loop_in : do {
$$0 = 3;
@@ -49549,7 +49549,7 @@ function asmFunc(global, env, buffer) {
}
function $$21() {
- var $$0 = 0, $$1 = 0;
+ var $$0 = 0, $$1 = 0, $$2 = 0, $$3 = 0;
fake_return_waka123 : {
loop_in : do {
dummy();
@@ -49677,7 +49677,7 @@ function asmFunc(global, env, buffer) {
}
function $$31() {
- var $$0 = 0, $$1 = 0, $$2 = 0;
+ var $$0 = 0, $$1 = 0, $$2 = 0, $$3 = 0;
$$if : {
$$0 = 2;
$$1 = $$0;
@@ -49686,8 +49686,8 @@ function asmFunc(global, env, buffer) {
break $$if;
};
};
- $$2 = $$1;
- return $$2 | 0;
+ $$3 = $$1;
+ return $$3 | 0;
}
function $$32($$0, $$1) {
diff --git a/test/merge/basics.wast.combined.finalized.opt b/test/merge/basics.wast.combined.finalized.opt
index 119851fb0..7f57d67da 100644
--- a/test/merge/basics.wast.combined.finalized.opt
+++ b/test/merge/basics.wast.combined.finalized.opt
@@ -68,8 +68,8 @@
(nop)
(drop
(i32.add
- (unreachable)
(i32.const 14)
+ (unreachable)
)
)
(nop)
diff --git a/test/passes/flatten-control-flow.txt b/test/passes/flatten-control-flow.txt
index d94536712..65e7196fb 100644
--- a/test/passes/flatten-control-flow.txt
+++ b/test/passes/flatten-control-flow.txt
@@ -1174,4 +1174,11 @@
(get_local $2)
)
)
+ (func $switch-unreachable (type $1)
+ (block $label$3
+ (block
+ (unreachable)
+ )
+ )
+ )
)
diff --git a/test/passes/flatten-control-flow.wast b/test/passes/flatten-control-flow.wast
index 69f3146c0..97ecf74c7 100644
--- a/test/passes/flatten-control-flow.wast
+++ b/test/passes/flatten-control-flow.wast
@@ -773,4 +773,11 @@
(i32.const 1)
)
)
+ (func $switch-unreachable
+ (block $label$3
+ (br_table $label$3
+ (unreachable)
+ )
+ )
+ )
)
diff --git a/test/passes/merge-blocks.txt b/test/passes/merge-blocks.txt
index f9ca7c3c1..be6906f0a 100644
--- a/test/passes/merge-blocks.txt
+++ b/test/passes/merge-blocks.txt
@@ -77,16 +77,12 @@
)
(func $drop-unreachable-br_if (type $2) (result i32)
(block $label$0 (result i32)
- (drop
- (block $label$2
- (drop
- (br_if $label$2
- (br $label$0
- (i32.const 538976371)
- )
- (i32.const 1918987552)
- )
+ (block $label$2 (result i32)
+ (br_if $label$2
+ (br $label$0
+ (i32.const 538976371)
)
+ (i32.const 1918987552)
)
)
)
diff --git a/test/passes/merge-blocks.wast b/test/passes/merge-blocks.wast
index d73612735..7cba9bf90 100644
--- a/test/passes/merge-blocks.wast
+++ b/test/passes/merge-blocks.wast
@@ -55,16 +55,12 @@
)
(func $drop-unreachable-br_if (result i32)
(block $label$0 (result i32)
- (drop
- (block $label$2
- (drop
- (br_if $label$2
- (br $label$0
- (i32.const 538976371)
- )
- (i32.const 1918987552)
- )
+ (block $label$2 (result i32)
+ (br_if $label$2
+ (br $label$0
+ (i32.const 538976371)
)
+ (i32.const 1918987552)
)
)
)
diff --git a/test/passes/optimize-instructions.txt b/test/passes/optimize-instructions.txt
index 55501dfb8..6a99ee106 100644
--- a/test/passes/optimize-instructions.txt
+++ b/test/passes/optimize-instructions.txt
@@ -355,8 +355,8 @@
)
(drop
(i32.and
- (unreachable)
(i32.const 1)
+ (unreachable)
)
)
(drop
@@ -2064,8 +2064,11 @@
)
(func $shifts-square-unreachable (type $3) (param $x i32) (result i32)
(i32.shr_u
- (unreachable)
- (i32.const 9)
+ (i32.shr_u
+ (unreachable)
+ (i32.const 1031)
+ )
+ (i32.const 4098)
)
)
(func $mix-shifts (type $2) (result i32)
diff --git a/test/passes/optimize-instructions_optimize-level=2_ignore-implicit-traps.txt b/test/passes/optimize-instructions_optimize-level=2_ignore-implicit-traps.txt
index 922f64008..85e0dd6d8 100644
--- a/test/passes/optimize-instructions_optimize-level=2_ignore-implicit-traps.txt
+++ b/test/passes/optimize-instructions_optimize-level=2_ignore-implicit-traps.txt
@@ -1,5 +1,6 @@
(module
(type $0 (func (param i32 i32) (result i32)))
+ (type $1 (func (result f64)))
(memory $0 0)
(func $conditionals (type $0) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
@@ -321,4 +322,41 @@
(get_local $1)
)
)
+ (func $conditionalize-if-type-change (type $1) (result f64)
+ (local $0 i32)
+ (drop
+ (loop $label$1 (result f32)
+ (block $label$2 (result f32)
+ (drop
+ (block $label$3 (result f32)
+ (br_if $label$1
+ (i32.or
+ (f32.gt
+ (br_if $label$3
+ (f32.const 1)
+ (get_local $0)
+ )
+ (br $label$2
+ (f32.const 71)
+ )
+ )
+ (i64.eqz
+ (select
+ (i64.const 58)
+ (i64.const -982757)
+ (i64.eqz
+ (i64.const 0)
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ (f32.const 1)
+ )
+ )
+ )
+ (f64.const -nan:0xfffffffffffff)
+ )
)
diff --git a/test/passes/optimize-instructions_optimize-level=2_ignore-implicit-traps.wast b/test/passes/optimize-instructions_optimize-level=2_ignore-implicit-traps.wast
index 7e8365812..6e19255ed 100644
--- a/test/passes/optimize-instructions_optimize-level=2_ignore-implicit-traps.wast
+++ b/test/passes/optimize-instructions_optimize-level=2_ignore-implicit-traps.wast
@@ -323,5 +323,43 @@
)
(return (get_local $1))
)
+
+ (func $conditionalize-if-type-change (result f64)
+ (local $0 i32)
+ (drop
+ (loop $label$1 (result f32)
+ (block $label$2 (result f32)
+ (drop
+ (block $label$3 (result f32)
+ (br_if $label$1
+ (i32.or ;; this turns into an if, but then the if might not be unreachable
+ (f32.gt
+ (br_if $label$3
+ (f32.const 1)
+ (get_local $0)
+ )
+ (br $label$2
+ (f32.const 71)
+ )
+ )
+ (i64.eqz
+ (select
+ (i64.const 58)
+ (i64.const -982757)
+ (i64.eqz
+ (i64.const 0)
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ (f32.const 1)
+ )
+ )
+ )
+ (f64.const -nan:0xfffffffffffff)
+ )
)
diff --git a/test/passes/precompute.txt b/test/passes/precompute.txt
index 74e4989dc..ad5b74e83 100644
--- a/test/passes/precompute.txt
+++ b/test/passes/precompute.txt
@@ -117,7 +117,7 @@
)
(func $br_if-condition-is-block-i32-but-unreachable-so-refinalize-tricky (type $2)
(drop
- (block $label$1
+ (block $label$1 (result i32)
(drop
(br_if $label$1
(i32.const 100)
@@ -157,4 +157,34 @@
(f64.const 4776014875438170098655851e156)
)
)
+ (func $refinalize-two-breaks-one-unreachable (type $2)
+ (drop
+ (block $label$0 (result i64)
+ (br_if $label$0
+ (select
+ (i64.const 1)
+ (block $block
+ (set_global $global$0
+ (i32.const 1)
+ )
+ (br $label$0
+ (i64.const -22)
+ )
+ )
+ (i32.const 0)
+ )
+ (i32.const 1)
+ )
+ )
+ )
+ )
+ (func $one-break-value-and-it-is-unreachable (type $3) (result f64)
+ (local $var$0 i32)
+ (block $label$6 (result f64)
+ (br_if $label$6
+ (unreachable)
+ (i32.const 0)
+ )
+ )
+ )
)
diff --git a/test/passes/precompute.wast b/test/passes/precompute.wast
index 3eb2683bf..b339a55d4 100644
--- a/test/passes/precompute.wast
+++ b/test/passes/precompute.wast
@@ -249,4 +249,35 @@
(f64.const 4776014875438170098655851e156)
)
)
+ (func $refinalize-two-breaks-one-unreachable
+ (drop
+ (block $label$0 (result i64)
+ (br_if $label$0
+ (select
+ (i64.const 1)
+ (block (result i64)
+ (set_global $global$0
+ (i32.const 1)
+ )
+ (br_if $label$0
+ (i64.const -22)
+ (i32.const -1)
+ )
+ )
+ (i32.const 0)
+ )
+ (i32.const 1)
+ )
+ )
+ )
+ )
+ (func $one-break-value-and-it-is-unreachable (result f64)
+ (local $var$0 i32)
+ (block $label$6 (result f64)
+ (br_if $label$6
+ (unreachable)
+ (i32.const 0)
+ )
+ )
+ )
)
diff --git a/test/passes/remove-unused-brs.txt b/test/passes/remove-unused-brs.txt
index 7951cf18f..6991680f7 100644
--- a/test/passes/remove-unused-brs.txt
+++ b/test/passes/remove-unused-brs.txt
@@ -332,7 +332,7 @@
)
)
(if
- (block $block6
+ (block $block6 (result i32)
(block $block15
(drop
(i32.const 2)
@@ -1037,11 +1037,23 @@
)
)
)
- (func $untaken-br-with-concrete-last-element (type $2) (result i32)
- (block $label$8 (result i32)
- (block $label$11 (result i32)
+ (func $untaken-br-with-concrete-last-element (type $1)
+ (block $label$8
+ (block $label$11
(block $label$14
(br_if $label$8
+ (br $label$8)
+ )
+ )
+ )
+ )
+ )
+ (func $untaken-br-with-concrete-last-element2 (type $2) (result i32)
+ (block $label$8 (result i32)
+ (block $label$11 (result i32)
+ (block $label$14 (result i32)
+ (br_if $label$14
+ (i32.const 102)
(br $label$11
(i32.const 103)
)
@@ -1062,25 +1074,29 @@
)
)
(func $unreachable-if-that-could-be-a-br_if (type $7) (result i64)
- (loop $label$3
- (if
- (unreachable)
- (f64.const 1)
- (br $label$3)
+ (loop $label$3 (result i64)
+ (drop
+ (if (result f64)
+ (unreachable)
+ (f64.const 1)
+ (br $label$3)
+ )
)
(i64.const 1)
)
)
(func $nop-br-might-update-type (type $1)
(block $label$39
- (if
- (unreachable)
+ (drop
(if (result i32)
- (i32.const 1)
- (br $label$39)
+ (unreachable)
+ (if (result i32)
+ (i32.const 1)
+ (br $label$39)
+ (i32.const 0)
+ )
(i32.const 0)
)
- (i32.const 0)
)
)
)
diff --git a/test/passes/remove-unused-brs.wast b/test/passes/remove-unused-brs.wast
index 20441d9e4..5c6776226 100644
--- a/test/passes/remove-unused-brs.wast
+++ b/test/passes/remove-unused-brs.wast
@@ -919,11 +919,24 @@
)
)
)
- (func $untaken-br-with-concrete-last-element (result i32)
+ (func $untaken-br-with-concrete-last-element
+ (block $label$8
+ (block $label$11
+ (block $label$14
+ (br_if $label$14
+ (br $label$11
+ )
+ )
+ )
+ )
+ )
+ )
+ (func $untaken-br-with-concrete-last-element2 (result i32)
(block $label$8 (result i32)
(block $label$11 (result i32)
- (block $label$14
+ (block $label$14 (result i32)
(br_if $label$14
+ (i32.const 102)
(br $label$11
(i32.const 103)
)
@@ -944,25 +957,29 @@
)
)
(func $unreachable-if-that-could-be-a-br_if (result i64)
- (loop $label$3
- (if
- (unreachable)
- (f64.const 1)
- (br $label$3)
+ (loop $label$3 (result i64)
+ (drop
+ (if (result f64)
+ (unreachable)
+ (f64.const 1)
+ (br $label$3)
+ )
)
(i64.const 1)
)
)
(func $nop-br-might-update-type
(block $label$39
- (if
- (unreachable)
+ (drop
(if (result i32)
- (i32.const 1)
- (br $label$39) ;; if we nop this, then the parent type must change
+ (unreachable)
+ (if (result i32)
+ (i32.const 1)
+ (br $label$39) ;; if we nop this, then the parent type must change
+ (i32.const 0)
+ )
(i32.const 0)
)
- (i32.const 0)
)
)
)
diff --git a/test/passes/remove-unused-names.txt b/test/passes/remove-unused-names.txt
index 894e07165..6fd0f4e51 100644
--- a/test/passes/remove-unused-names.txt
+++ b/test/passes/remove-unused-names.txt
@@ -66,15 +66,13 @@
)
(func $merge-typed-with-unreachable-child (type $2) (result i32)
(local $0 f32)
- (block $label$0 (result i32)
- (block $label$1
+ (block $label$1 (result i32)
+ (br_if $label$1
+ (i32.const 1)
(br_if $label$1
(i32.const 0)
- (br_if $label$0
+ (br $label$1
(i32.const 0)
- (br $label$0
- (i32.const 0)
- )
)
)
)
diff --git a/test/passes/remove-unused-names.wast b/test/passes/remove-unused-names.wast
index dc882cf4c..a4c240f02 100644
--- a/test/passes/remove-unused-names.wast
+++ b/test/passes/remove-unused-names.wast
@@ -80,9 +80,9 @@
(func $merge-typed-with-unreachable-child (result i32)
(local $0 f32)
(block $label$0 (result i32)
- (block $label$1
+ (block $label$1 (result i32)
(br_if $label$1
- (i32.const 0)
+ (i32.const 1)
(br_if $label$0
(i32.const 0)
(br $label$0
diff --git a/test/passes/remove-unused-names_merge-blocks.txt b/test/passes/remove-unused-names_merge-blocks.txt
index 19f03c662..c170a6c99 100644
--- a/test/passes/remove-unused-names_merge-blocks.txt
+++ b/test/passes/remove-unused-names_merge-blocks.txt
@@ -853,9 +853,11 @@
(unreachable)
)
(func $concrete_finale_in_unreachable (type $5) (result f64)
- (unreachable)
(drop
- (f64.const 6.322092475576799e-96)
+ (block (result f64)
+ (unreachable)
+ (f64.const 6.322092475576799e-96)
+ )
)
(f64.const -1)
)
@@ -897,7 +899,7 @@
)
(func $drop-unreachable-block-with-concrete-final (type $3)
(drop
- (block
+ (block (result i32)
(drop
(block
(drop
diff --git a/test/passes/remove-unused-names_merge-blocks.wast b/test/passes/remove-unused-names_merge-blocks.wast
index 6f6dd92b9..67a1f2762 100644
--- a/test/passes/remove-unused-names_merge-blocks.wast
+++ b/test/passes/remove-unused-names_merge-blocks.wast
@@ -1007,9 +1007,11 @@
)
(func $concrete_finale_in_unreachable (result f64)
(block $label$0 (result f64)
- (block ;; this block is unreachable
- (unreachable)
- (f64.const 6.322092475576799e-96)
+ (drop
+ (block (result f64)
+ (unreachable)
+ (f64.const 6.322092475576799e-96)
+ )
)
(f64.const -1)
)
@@ -1056,7 +1058,7 @@
)
(func $drop-unreachable-block-with-concrete-final
(drop
- (block
+ (block (result i32)
(drop
(block
(drop
@@ -1070,7 +1072,7 @@
)
(func $merging-with-unreachable-in-middle (result i32)
(block $label$1 (result i32)
- (block
+ (block (result i32)
(return
(i32.const 21536)
)
diff --git a/test/passes/simplify-locals.txt b/test/passes/simplify-locals.txt
index 39fc1d97d..15d8b21e5 100644
--- a/test/passes/simplify-locals.txt
+++ b/test/passes/simplify-locals.txt
@@ -877,17 +877,13 @@
)
)
(func $if-return-but-unreachable (type $10) (param $var$0 i64)
- (tee_local $var$0
- (if
- (unreachable)
- (block (result i64)
- (nop)
- (get_local $var$0)
- )
- (block (result i64)
- (nop)
- (i64.const 1)
- )
+ (if
+ (unreachable)
+ (set_local $var$0
+ (get_local $var$0)
+ )
+ (set_local $var$0
+ (i64.const 1)
)
)
)
diff --git a/test/passes/vacuum.txt b/test/passes/vacuum.txt
index 011fb99f5..b254179cd 100644
--- a/test/passes/vacuum.txt
+++ b/test/passes/vacuum.txt
@@ -223,7 +223,7 @@
)
)
(func $leave-block-even-if-br-not-taken (type $6) (result f64)
- (block $label$0
+ (block $label$0 (result f64)
(f64.store align=1
(i32.const 879179022)
(br_if $label$0
@@ -276,12 +276,11 @@
(func $unreachable-if-with-nop-arm-that-leaves-a-concrete-value-if-nop-is-removed (type $0)
(block $label$0
(loop $label$1
- (br_if $label$0
- (i32.load8_s
- (i32.const 1634541608)
- )
- (loop $label$9
- (br $label$9)
+ (drop
+ (br_if $label$0
+ (loop $label$9
+ (br $label$9)
+ )
)
)
)
diff --git a/test/passes/vacuum.wast b/test/passes/vacuum.wast
index 3b5b22e9c..dbbffee41 100644
--- a/test/passes/vacuum.wast
+++ b/test/passes/vacuum.wast
@@ -502,7 +502,7 @@
(local $2 i32)
(block $label$0
(drop
- (block
+ (block (result i32)
(br $label$0)
(get_local $2)
)
@@ -596,17 +596,16 @@
(func $unreachable-if-with-nop-arm-that-leaves-a-concrete-value-if-nop-is-removed
(block $label$0
(loop $label$1
- (if
- (br_if $label$0
- (i32.load8_s
- (i32.const 1634541608)
- )
- (loop $label$9
- (br $label$9)
+ (drop
+ (if (result i32)
+ (br_if $label$0
+ (loop $label$9
+ (br $label$9)
+ )
)
+ (unreachable)
+ (i32.const 1920103026)
)
- (nop)
- (i32.const 1920103026)
)
)
)
diff --git a/test/polymorphic_stack.wast b/test/polymorphic_stack.wast
index 1b2459148..d0b9986ba 100644
--- a/test/polymorphic_stack.wast
+++ b/test/polymorphic_stack.wast
@@ -80,7 +80,8 @@
(func $untaken-break-should-have-value (result i32)
(block $x (result i32)
(block
- (br_if $x ;; ok to not have a value, since an untaken branch. but must emit valid binary for wasm
+ (br_if $x
+ (i32.const 0)
(unreachable)
)
)
@@ -95,6 +96,7 @@
)
(block $label$0 (result i32)
(br_if $label$0
+ (i32.const 0)
(return
(i32.const -32)
)
@@ -103,7 +105,7 @@
)
(func $br_table_unreachable_to_also_unreachable (result i32)
(block $a (result i32)
- (block $b
+ (block $b (result i32)
(br_table $a $b ;; seems to send a value, but is not taken
(unreachable)
(unreachable)
@@ -111,5 +113,21 @@
)
)
)
+ (func $untaken-br_if (result i32)
+ (block $label$8 (result i32)
+ (block $label$9
+ (drop
+ (if
+ (i32.const 0)
+ (br_if $label$8
+ (unreachable)
+ (i32.const 0)
+ )
+ (unreachable)
+ )
+ )
+ )
+ )
+ )
)
diff --git a/test/polymorphic_stack.wast.from-wast b/test/polymorphic_stack.wast.from-wast
index 82f88f4af..8b514d8f4 100644
--- a/test/polymorphic_stack.wast.from-wast
+++ b/test/polymorphic_stack.wast.from-wast
@@ -85,6 +85,7 @@
(block $x (result i32)
(block $block
(br_if $x
+ (i32.const 0)
(unreachable)
)
)
@@ -99,6 +100,7 @@
)
(block $label$0 (result i32)
(br_if $label$0
+ (i32.const 0)
(return
(i32.const -32)
)
@@ -107,7 +109,7 @@
)
(func $br_table_unreachable_to_also_unreachable (type $1) (result i32)
(block $a (result i32)
- (block $b
+ (block $b (result i32)
(br_table $a $b
(unreachable)
(unreachable)
@@ -115,4 +117,20 @@
)
)
)
+ (func $untaken-br_if (type $1) (result i32)
+ (block $label$8 (result i32)
+ (block $label$9
+ (drop
+ (if
+ (i32.const 0)
+ (br_if $label$8
+ (unreachable)
+ (i32.const 0)
+ )
+ (unreachable)
+ )
+ )
+ )
+ )
+ )
)
diff --git a/test/polymorphic_stack.wast.fromBinary b/test/polymorphic_stack.wast.fromBinary
index 68bb7ecf7..709d131c0 100644
--- a/test/polymorphic_stack.wast.fromBinary
+++ b/test/polymorphic_stack.wast.fromBinary
@@ -36,6 +36,9 @@
(func $untaken-break-should-have-value (type $1) (result i32)
(block $label$0 (result i32)
(block $label$1
+ (drop
+ (i32.const 0)
+ )
(unreachable)
)
(unreachable)
@@ -52,6 +55,9 @@
)
)
(block $label$2 (result i32)
+ (drop
+ (i32.const 0)
+ )
(return
(i32.const -32)
)
@@ -60,9 +66,24 @@
)
(func $br_table_unreachable_to_also_unreachable (type $1) (result i32)
(block $label$0 (result i32)
- (block $label$1
+ (block $label$1 (result i32)
(unreachable)
)
+ )
+ )
+ (func $untaken-br_if (type $1) (result i32)
+ (block $label$0 (result i32)
+ (block $label$1
+ (if
+ (i32.const 0)
+ (block $label$2
+ (unreachable)
+ )
+ (block $label$3
+ (unreachable)
+ )
+ )
+ )
(unreachable)
)
)
diff --git a/test/polymorphic_stack.wast.fromBinary.noDebugInfo b/test/polymorphic_stack.wast.fromBinary.noDebugInfo
index 69292952e..3c0af4265 100644
--- a/test/polymorphic_stack.wast.fromBinary.noDebugInfo
+++ b/test/polymorphic_stack.wast.fromBinary.noDebugInfo
@@ -36,6 +36,9 @@
(func $5 (type $1) (result i32)
(block $label$0 (result i32)
(block $label$1
+ (drop
+ (i32.const 0)
+ )
(unreachable)
)
(unreachable)
@@ -52,6 +55,9 @@
)
)
(block $label$2 (result i32)
+ (drop
+ (i32.const 0)
+ )
(return
(i32.const -32)
)
@@ -60,9 +66,24 @@
)
(func $7 (type $1) (result i32)
(block $label$0 (result i32)
- (block $label$1
+ (block $label$1 (result i32)
(unreachable)
)
+ )
+ )
+ (func $8 (type $1) (result i32)
+ (block $label$0 (result i32)
+ (block $label$1
+ (if
+ (i32.const 0)
+ (block $label$2
+ (unreachable)
+ )
+ (block $label$3
+ (unreachable)
+ )
+ )
+ )
(unreachable)
)
)
diff --git a/test/spec b/test/spec
-Subproject 668281b3d7dfe9be6cbc3c4500b537c49d6449b
+Subproject 8b1077b8a9e75054ec373b064a25fd23e9a3971
diff --git a/test/unit.wast b/test/unit.wast
index a429675de..c28e7b7f8 100644
--- a/test/unit.wast
+++ b/test/unit.wast
@@ -545,7 +545,9 @@
)
(block
(unreachable)
- (i32.const 1) ;; ends in a concrete, after an unreachable
+ (drop
+ (i32.const 1)
+ )
)
)
)
diff --git a/test/unit.wast.from-wast b/test/unit.wast.from-wast
index 7fb82d69d..721b6c3d2 100644
--- a/test/unit.wast.from-wast
+++ b/test/unit.wast.from-wast
@@ -610,7 +610,9 @@
)
(block $block12
(unreachable)
- (i32.const 1)
+ (drop
+ (i32.const 1)
+ )
)
)
)
diff --git a/test/untaken-br_if.wast b/test/untaken-br_if.wast
index a165cf67f..92ed74c95 100644
--- a/test/untaken-br_if.wast
+++ b/test/untaken-br_if.wast
@@ -1,11 +1,11 @@
(module
(func $binaryify-untaken-br_if (result f32)
- (if
+ (if (result f32)
(i32.const 1)
(unreachable)
- (block $label$1
+ (block $label$1 (result f32)
(br_if $label$1
- (i32.const 1)
+ (f32.const 1)
(unreachable)
)
)
diff --git a/test/untaken-br_if.wast.from-wast b/test/untaken-br_if.wast.from-wast
index 2d6d9dd2d..86ce53f41 100644
--- a/test/untaken-br_if.wast.from-wast
+++ b/test/untaken-br_if.wast.from-wast
@@ -2,12 +2,12 @@
(type $0 (func (result f32)))
(memory $0 0)
(func $binaryify-untaken-br_if (type $0) (result f32)
- (if
+ (if (result f32)
(i32.const 1)
(unreachable)
- (block $label$1
+ (block $label$1 (result f32)
(br_if $label$1
- (i32.const 1)
+ (f32.const 1)
(unreachable)
)
)
diff --git a/test/untaken-br_if.wast.fromBinary b/test/untaken-br_if.wast.fromBinary
index 815789c35..fc2e7f215 100644
--- a/test/untaken-br_if.wast.fromBinary
+++ b/test/untaken-br_if.wast.fromBinary
@@ -2,15 +2,15 @@
(type $0 (func (result f32)))
(memory $0 0)
(func $binaryify-untaken-br_if (type $0) (result f32)
- (if
+ (if (result f32)
(i32.const 1)
- (block $label$0
+ (block $label$0 (result f32)
(unreachable)
)
- (block $label$1
- (block $label$2
+ (block $label$1 (result f32)
+ (block $label$2 (result f32)
(drop
- (i32.const 1)
+ (f32.const 1)
)
(unreachable)
)
diff --git a/test/untaken-br_if.wast.fromBinary.noDebugInfo b/test/untaken-br_if.wast.fromBinary.noDebugInfo
index 9b31417eb..b15b0f0b4 100644
--- a/test/untaken-br_if.wast.fromBinary.noDebugInfo
+++ b/test/untaken-br_if.wast.fromBinary.noDebugInfo
@@ -2,15 +2,15 @@
(type $0 (func (result f32)))
(memory $0 0)
(func $0 (type $0) (result f32)
- (if
+ (if (result f32)
(i32.const 1)
- (block $label$0
+ (block $label$0 (result f32)
(unreachable)
)
- (block $label$1
- (block $label$2
+ (block $label$1 (result f32)
+ (block $label$2 (result f32)
(drop
- (i32.const 1)
+ (f32.const 1)
)
(unreachable)
)