summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/emcc_O2_hello_world.fromasm340
-rw-r--r--test/emcc_hello_world.fromasm342
-rw-r--r--test/passes/merge-blocks.txt170
-rw-r--r--test/passes/merge-blocks.wast86
-rw-r--r--test/unit.2asm.js10
-rw-r--r--test/unit.wast7
6 files changed, 589 insertions, 366 deletions
diff --git a/test/emcc_O2_hello_world.fromasm b/test/emcc_O2_hello_world.fromasm
index 84e10d632..e056b0c05 100644
--- a/test/emcc_O2_hello_world.fromasm
+++ b/test/emcc_O2_hello_world.fromasm
@@ -3710,22 +3710,20 @@
(i32.const 608)
)
)
- (block
- (set_local $i50
- (i32.add
- (get_local $i51)
- (get_local $i43)
- )
+ (set_local $i50
+ (i32.add
+ (get_local $i51)
+ (get_local $i43)
)
- (i32.or
- (i32.le_u
- (get_local $i50)
- (get_local $i51)
- )
- (i32.gt_u
- (get_local $i50)
- (get_local $i52)
- )
+ )
+ (i32.or
+ (i32.le_u
+ (get_local $i50)
+ (get_local $i51)
+ )
+ (i32.gt_u
+ (get_local $i50)
+ (get_local $i52)
)
)
)
@@ -4091,26 +4089,24 @@
(i32.const 656)
)
)
- (block
- (set_local $i5
- (i32.and
- (i32.add
- (i32.sub
- (get_local $i44)
- (get_local $i61)
- )
- (get_local $i52)
- )
+ (set_local $i5
+ (i32.and
+ (i32.add
(i32.sub
- (i32.const 0)
- (get_local $i52)
+ (get_local $i44)
+ (get_local $i61)
)
+ (get_local $i52)
+ )
+ (i32.sub
+ (i32.const 0)
+ (get_local $i52)
)
)
- (i32.lt_u
- (get_local $i5)
- (i32.const 2147483647)
- )
+ )
+ (i32.lt_u
+ (get_local $i5)
+ (i32.const 2147483647)
)
)
(i32.const 0)
@@ -4202,26 +4198,24 @@
(get_local $i43)
)
)
- (block
- (set_local $i43
- (call_import $_sbrk
- (i32.const 0)
- )
+ (set_local $i43
+ (call_import $_sbrk
+ (i32.const 0)
+ )
+ )
+ (i32.and
+ (i32.lt_u
+ (get_local $i63)
+ (get_local $i43)
)
(i32.and
- (i32.lt_u
+ (i32.ne
(get_local $i63)
- (get_local $i43)
+ (i32.const -1)
)
- (i32.and
- (i32.ne
- (get_local $i63)
- (i32.const -1)
- )
- (i32.ne
- (get_local $i43)
- (i32.const -1)
- )
+ (i32.ne
+ (get_local $i43)
+ (i32.const -1)
)
)
)
@@ -10755,39 +10749,37 @@
(nop)
(br $while-out$0)
)
- (block
- (if
- (i32.eq
- (get_local $i3)
- (i32.const 0)
- )
- (br $topmost
- (get_local $i4)
- )
+ (if
+ (i32.eq
+ (get_local $i3)
+ (i32.const 0)
)
- (i32.store8 align=1
- (get_local $i1)
- (i32.load8_s align=1
- (get_local $i2)
- )
+ (br $topmost
+ (get_local $i4)
)
- (set_local $i1
- (i32.add
- (get_local $i1)
- (i32.const 1)
- )
+ )
+ (i32.store8 align=1
+ (get_local $i1)
+ (i32.load8_s align=1
+ (get_local $i2)
)
- (set_local $i2
- (i32.add
- (get_local $i2)
- (i32.const 1)
- )
+ )
+ (set_local $i1
+ (i32.add
+ (get_local $i1)
+ (i32.const 1)
)
- (set_local $i3
- (i32.sub
- (get_local $i3)
- (i32.const 1)
- )
+ )
+ (set_local $i2
+ (i32.add
+ (get_local $i2)
+ (i32.const 1)
+ )
+ )
+ (set_local $i3
+ (i32.sub
+ (get_local $i3)
+ (i32.const 1)
)
)
(br $while-in$1)
@@ -10803,30 +10795,28 @@
(nop)
(br $while-out$2)
)
- (block
- (i32.store align=4
- (get_local $i1)
- (i32.load align=4
- (get_local $i2)
- )
+ (i32.store align=4
+ (get_local $i1)
+ (i32.load align=4
+ (get_local $i2)
)
- (set_local $i1
- (i32.add
- (get_local $i1)
- (i32.const 4)
- )
+ )
+ (set_local $i1
+ (i32.add
+ (get_local $i1)
+ (i32.const 4)
)
- (set_local $i2
- (i32.add
- (get_local $i2)
- (i32.const 4)
- )
+ )
+ (set_local $i2
+ (i32.add
+ (get_local $i2)
+ (i32.const 4)
)
- (set_local $i3
- (i32.sub
- (get_local $i3)
- (i32.const 4)
- )
+ )
+ (set_local $i3
+ (i32.sub
+ (get_local $i3)
+ (i32.const 4)
)
)
(br $while-in$3)
@@ -10844,30 +10834,28 @@
(nop)
(br $while-out$4)
)
- (block
- (i32.store8 align=1
- (get_local $i1)
- (i32.load8_s align=1
- (get_local $i2)
- )
+ (i32.store8 align=1
+ (get_local $i1)
+ (i32.load8_s align=1
+ (get_local $i2)
)
- (set_local $i1
- (i32.add
- (get_local $i1)
- (i32.const 1)
- )
+ )
+ (set_local $i1
+ (i32.add
+ (get_local $i1)
+ (i32.const 1)
)
- (set_local $i2
- (i32.add
- (get_local $i2)
- (i32.const 1)
- )
+ )
+ (set_local $i2
+ (i32.add
+ (get_local $i2)
+ (i32.const 1)
)
- (set_local $i3
- (i32.sub
- (get_local $i3)
- (i32.const 1)
- )
+ )
+ (set_local $i3
+ (i32.sub
+ (get_local $i3)
+ (i32.const 1)
)
)
(br $while-in$5)
@@ -10960,16 +10948,14 @@
(nop)
(br $while-out$0)
)
- (block
- (i32.store8 align=1
+ (i32.store8 align=1
+ (get_local $i1)
+ (get_local $i2)
+ )
+ (set_local $i1
+ (i32.add
(get_local $i1)
- (get_local $i2)
- )
- (set_local $i1
- (i32.add
- (get_local $i1)
- (i32.const 1)
- )
+ (i32.const 1)
)
)
(br $while-in$1)
@@ -10987,16 +10973,14 @@
(nop)
(br $while-out$2)
)
- (block
- (i32.store align=4
+ (i32.store align=4
+ (get_local $i1)
+ (get_local $i6)
+ )
+ (set_local $i1
+ (i32.add
(get_local $i1)
- (get_local $i6)
- )
- (set_local $i1
- (i32.add
- (get_local $i1)
- (i32.const 4)
- )
+ (i32.const 4)
)
)
(br $while-in$3)
@@ -11014,16 +10998,14 @@
(nop)
(br $while-out$4)
)
- (block
- (i32.store8 align=1
+ (i32.store8 align=1
+ (get_local $i1)
+ (get_local $i2)
+ )
+ (set_local $i1
+ (i32.add
(get_local $i1)
- (get_local $i2)
- )
- (set_local $i1
- (i32.add
- (get_local $i1)
- (i32.const 1)
- )
+ (i32.const 1)
)
)
(br $while-in$5)
@@ -11095,19 +11077,17 @@
(i32.const 20)
)
)
- (block
- (set_local $i6
- (i32.load align=4
- (get_local $i5)
- )
+ (set_local $i6
+ (i32.load align=4
+ (get_local $i5)
)
- (i32.lt_u
- (get_local $i6)
- (i32.load align=4
- (i32.add
- (get_local $i2)
- (i32.const 16)
- )
+ )
+ (i32.lt_u
+ (get_local $i6)
+ (i32.load align=4
+ (i32.add
+ (get_local $i2)
+ (i32.const 16)
)
)
)
@@ -11489,33 +11469,29 @@
)
)
)
- (block
- (i32.store align=4
- (i32.add
- (get_local $i5)
- (i32.const 4)
- )
- (i32.const 21505)
+ (i32.store align=4
+ (i32.add
+ (get_local $i5)
+ (i32.const 4)
)
- (block
- (i32.store align=4
- (i32.add
- (get_local $i5)
- (i32.const 8)
- )
- (i32.add
- (get_local $i4)
- (i32.const 12)
- )
- )
- (i32.ne
- (call_import $___syscall54
- (i32.const 54)
- (get_local $i5)
- )
- (i32.const 0)
- )
+ (i32.const 21505)
+ )
+ (i32.store align=4
+ (i32.add
+ (get_local $i5)
+ (i32.const 8)
)
+ (i32.add
+ (get_local $i4)
+ (i32.const 12)
+ )
+ )
+ (i32.ne
+ (call_import $___syscall54
+ (i32.const 54)
+ (get_local $i5)
+ )
+ (i32.const 0)
)
)
(i32.const 0)
diff --git a/test/emcc_hello_world.fromasm b/test/emcc_hello_world.fromasm
index bea407a53..574eb098a 100644
--- a/test/emcc_hello_world.fromasm
+++ b/test/emcc_hello_world.fromasm
@@ -30427,13 +30427,11 @@
)
)
)
- (block
- (i32.store align=4
- (i32.const 168)
- (get_local $h)
- )
- (get_local $l)
+ (i32.store align=4
+ (i32.const 168)
+ (get_local $h)
)
+ (get_local $l)
)
(func $_i64Add (param $a i32) (param $b i32) (param $c i32) (param $d i32) (result i32)
(local $l i32)
@@ -30456,13 +30454,11 @@
)
)
)
- (block
- (i32.store align=4
- (i32.const 168)
- (get_local $h)
- )
- (get_local $l)
+ (i32.store align=4
+ (i32.const 168)
+ (get_local $h)
)
+ (get_local $l)
)
(func $_memset (param $ptr i32) (param $value i32) (param $num i32) (result i32)
(local $stop i32)
@@ -30545,16 +30541,14 @@
(nop)
(br $while-out$0)
)
- (block
- (i32.store8 align=1
+ (i32.store8 align=1
+ (get_local $ptr)
+ (get_local $value)
+ )
+ (set_local $ptr
+ (i32.add
(get_local $ptr)
- (get_local $value)
- )
- (set_local $ptr
- (i32.add
- (get_local $ptr)
- (i32.const 1)
- )
+ (i32.const 1)
)
)
(br $while-in$1)
@@ -30572,16 +30566,14 @@
(nop)
(br $while-out$2)
)
- (block
- (i32.store align=4
+ (i32.store align=4
+ (get_local $ptr)
+ (get_local $value4)
+ )
+ (set_local $ptr
+ (i32.add
(get_local $ptr)
- (get_local $value4)
- )
- (set_local $ptr
- (i32.add
- (get_local $ptr)
- (i32.const 4)
- )
+ (i32.const 4)
)
)
(br $while-in$3)
@@ -30599,16 +30591,14 @@
(nop)
(br $while-out$4)
)
- (block
- (i32.store8 align=1
+ (i32.store8 align=1
+ (get_local $ptr)
+ (get_local $value)
+ )
+ (set_local $ptr
+ (i32.add
(get_local $ptr)
- (get_local $value)
- )
- (set_local $ptr
- (i32.add
- (get_local $ptr)
- (i32.const 1)
- )
+ (i32.const 1)
)
)
(br $while-in$5)
@@ -30782,39 +30772,37 @@
(nop)
(br $while-out$0)
)
- (block
- (if
- (i32.eq
- (get_local $num)
- (i32.const 0)
- )
- (br $topmost
- (get_local $ret)
- )
+ (if
+ (i32.eq
+ (get_local $num)
+ (i32.const 0)
)
- (i32.store8 align=1
- (get_local $dest)
- (i32.load8_s align=1
- (get_local $src)
- )
+ (br $topmost
+ (get_local $ret)
)
- (set_local $dest
- (i32.add
- (get_local $dest)
- (i32.const 1)
- )
+ )
+ (i32.store8 align=1
+ (get_local $dest)
+ (i32.load8_s align=1
+ (get_local $src)
)
- (set_local $src
- (i32.add
- (get_local $src)
- (i32.const 1)
- )
+ )
+ (set_local $dest
+ (i32.add
+ (get_local $dest)
+ (i32.const 1)
)
- (set_local $num
- (i32.sub
- (get_local $num)
- (i32.const 1)
- )
+ )
+ (set_local $src
+ (i32.add
+ (get_local $src)
+ (i32.const 1)
+ )
+ )
+ (set_local $num
+ (i32.sub
+ (get_local $num)
+ (i32.const 1)
)
)
(br $while-in$1)
@@ -30830,30 +30818,28 @@
(nop)
(br $while-out$2)
)
- (block
- (i32.store align=4
- (get_local $dest)
- (i32.load align=4
- (get_local $src)
- )
+ (i32.store align=4
+ (get_local $dest)
+ (i32.load align=4
+ (get_local $src)
)
- (set_local $dest
- (i32.add
- (get_local $dest)
- (i32.const 4)
- )
+ )
+ (set_local $dest
+ (i32.add
+ (get_local $dest)
+ (i32.const 4)
)
- (set_local $src
- (i32.add
- (get_local $src)
- (i32.const 4)
- )
+ )
+ (set_local $src
+ (i32.add
+ (get_local $src)
+ (i32.const 4)
)
- (set_local $num
- (i32.sub
- (get_local $num)
- (i32.const 4)
- )
+ )
+ (set_local $num
+ (i32.sub
+ (get_local $num)
+ (i32.const 4)
)
)
(br $while-in$3)
@@ -30871,30 +30857,28 @@
(nop)
(br $while-out$4)
)
- (block
- (i32.store8 align=1
- (get_local $dest)
- (i32.load8_s align=1
- (get_local $src)
- )
+ (i32.store8 align=1
+ (get_local $dest)
+ (i32.load8_s align=1
+ (get_local $src)
)
- (set_local $dest
- (i32.add
- (get_local $dest)
- (i32.const 1)
- )
+ )
+ (set_local $dest
+ (i32.add
+ (get_local $dest)
+ (i32.const 1)
)
- (set_local $src
- (i32.add
- (get_local $src)
- (i32.const 1)
- )
+ )
+ (set_local $src
+ (i32.add
+ (get_local $src)
+ (i32.const 1)
)
- (set_local $num
- (i32.sub
- (get_local $num)
- (i32.const 1)
- )
+ )
+ (set_local $num
+ (i32.sub
+ (get_local $num)
+ (i32.const 1)
)
)
(br $while-in$5)
@@ -31121,46 +31105,44 @@
(get_local $$1)
)
)
- (block
- (i32.store align=4
- (i32.const 168)
+ (i32.store align=4
+ (i32.const 168)
+ (i32.add
(i32.add
- (i32.add
- (i32.shr_u
- (get_local $$8)
- (i32.const 16)
- )
- (i32.mul
- (get_local $$11)
- (get_local $$6)
- )
- )
(i32.shr_u
- (i32.add
- (i32.and
- (get_local $$8)
- (i32.const 65535)
- )
- (get_local $$12)
- )
+ (get_local $$8)
(i32.const 16)
)
+ (i32.mul
+ (get_local $$11)
+ (get_local $$6)
+ )
)
- )
- (i32.or
- (i32.const 0)
- (i32.or
- (i32.shl
- (i32.add
+ (i32.shr_u
+ (i32.add
+ (i32.and
(get_local $$8)
- (get_local $$12)
+ (i32.const 65535)
)
- (i32.const 16)
+ (get_local $$12)
)
- (i32.and
- (get_local $$3)
- (i32.const 65535)
+ (i32.const 16)
+ )
+ )
+ )
+ (i32.or
+ (i32.const 0)
+ (i32.or
+ (i32.shl
+ (i32.add
+ (get_local $$8)
+ (get_local $$12)
)
+ (i32.const 16)
+ )
+ (i32.and
+ (get_local $$3)
+ (i32.const 65535)
)
)
)
@@ -31532,13 +31514,11 @@
(i32.const 8)
(get_local $__stackBase__)
)
- (block
- (i32.store align=4
- (i32.const 168)
- (get_local $$10$1)
- )
- (get_local $$10$0)
+ (i32.store align=4
+ (i32.const 168)
+ (get_local $$10$1)
)
+ (get_local $$10$0)
)
(func $___muldi3 (param $$a$0 i32) (param $$a$1 i32) (param $$b$0 i32) (param $$b$1 i32) (result i32)
(local $$x_sroa_0_0_extract_trunc i32)
@@ -31569,34 +31549,32 @@
(get_local $$y_sroa_0_0_extract_trunc)
)
)
- (block
- (i32.store align=4
- (i32.const 168)
- (i32.or
+ (i32.store align=4
+ (i32.const 168)
+ (i32.or
+ (i32.add
(i32.add
- (i32.add
- (i32.mul
- (get_local $$b$1)
- (get_local $$x_sroa_0_0_extract_trunc)
- )
- (get_local $$2)
+ (i32.mul
+ (get_local $$b$1)
+ (get_local $$x_sroa_0_0_extract_trunc)
)
- (get_local $$1$1)
- )
- (i32.and
- (get_local $$1$1)
- (i32.const 0)
+ (get_local $$2)
)
+ (get_local $$1$1)
)
- )
- (i32.or
- (i32.const 0)
(i32.and
- (get_local $$1$0)
- (i32.const -1)
+ (get_local $$1$1)
+ (i32.const 0)
)
)
)
+ (i32.or
+ (i32.const 0)
+ (i32.and
+ (get_local $$1$0)
+ (i32.const -1)
+ )
+ )
)
(func $___udivdi3 (param $$a$0 i32) (param $$a$1 i32) (param $$b$0 i32) (param $$b$1 i32) (result i32)
(local $$1$0 i32)
@@ -31642,20 +31620,18 @@
(i32.const 8)
(get_local $__stackBase__)
)
- (block
- (i32.store align=4
- (i32.const 168)
- (i32.load align=4
- (i32.add
- (get_local $$rem)
- (i32.const 4)
- )
- )
- )
+ (i32.store align=4
+ (i32.const 168)
(i32.load align=4
- (get_local $$rem)
+ (i32.add
+ (get_local $$rem)
+ (i32.const 4)
+ )
)
)
+ (i32.load align=4
+ (get_local $$rem)
+ )
)
(func $___udivmoddi4 (param $$a$0 i32) (param $$a$1 i32) (param $$b$0 i32) (param $$b$1 i32) (param $$rem i32) (result i32)
(local $$n_sroa_0_0_extract_trunc i32)
@@ -32901,13 +32877,11 @@
(get_local $$carry_0_lcssa$0)
)
)
- (block
- (i32.store align=4
- (i32.const 168)
- (get_local $$_0$1)
- )
- (get_local $$_0$0)
+ (i32.store align=4
+ (i32.const 168)
+ (get_local $$_0$1)
)
+ (get_local $$_0$0)
)
)
(func $dynCall_ii (param $index i32) (param $a1 i32) (result i32)
diff --git a/test/passes/merge-blocks.txt b/test/passes/merge-blocks.txt
new file mode 100644
index 000000000..876fe7b2f
--- /dev/null
+++ b/test/passes/merge-blocks.txt
@@ -0,0 +1,170 @@
+(module
+ (memory 16777216 16777216)
+ (func $b0-yes (param $i1 i32)
+ (block $topmost
+ (block $block0
+ (i32.const 10)
+ )
+ )
+ )
+ (func $b1-yes (param $i1 i32)
+ (block $topmost
+ (block $block0
+ (block $block1
+ (i32.const 10)
+ )
+ )
+ )
+ )
+ (func $b2-yes (param $i1 i32)
+ (block $topmost
+ (i32.const 5)
+ (block $block0
+ (i32.const 10)
+ )
+ (i32.const 15)
+ )
+ )
+ (func $b3-yes (param $i1 i32)
+ (block $topmost
+ (i32.const 3)
+ (block $block0
+ (i32.const 6)
+ (block $block1
+ (i32.const 10)
+ )
+ (i32.const 15)
+ )
+ (i32.const 20)
+ )
+ )
+ (func $b4 (param $i1 i32)
+ (block $topmost
+ (block $inner
+ (i32.const 10)
+ (br $inner)
+ )
+ )
+ )
+ (func $b5 (param $i1 i32)
+ (block $topmost
+ (block $middle
+ (block $inner
+ (i32.const 10)
+ (br $inner)
+ )
+ (br $middle)
+ )
+ )
+ )
+ (func $b6 (param $i1 i32)
+ (block $topmost
+ (i32.const 5)
+ (block $inner
+ (i32.const 10)
+ (br $inner)
+ )
+ (i32.const 15)
+ )
+ )
+ (func $b7 (param $i1 i32)
+ (block $topmost
+ (i32.const 3)
+ (block $middle
+ (i32.const 6)
+ (block $inner
+ (i32.const 10)
+ (br $inner)
+ )
+ (i32.const 15)
+ (br $middle)
+ )
+ (i32.const 20)
+ )
+ )
+)
+(module
+ (memory 16777216 16777216)
+ (func $b0-yes (param $i1 i32)
+ (block $topmost
+ (block $block0
+ (i32.const 10)
+ )
+ )
+ )
+ (func $b1-yes (param $i1 i32)
+ (block $topmost
+ (block $block0
+ (block $block1
+ (i32.const 10)
+ )
+ )
+ )
+ )
+ (func $b2-yes (param $i1 i32)
+ (block $topmost
+ (i32.const 5)
+ (block $block0
+ (i32.const 10)
+ )
+ (i32.const 15)
+ )
+ )
+ (func $b3-yes (param $i1 i32)
+ (block $topmost
+ (i32.const 3)
+ (block $block0
+ (i32.const 6)
+ (block $block1
+ (i32.const 10)
+ )
+ (i32.const 15)
+ )
+ (i32.const 20)
+ )
+ )
+ (func $b4 (param $i1 i32)
+ (block $topmost
+ (block $inner
+ (i32.const 10)
+ (br $inner)
+ )
+ )
+ )
+ (func $b5 (param $i1 i32)
+ (block $topmost
+ (block $middle
+ (block $inner
+ (i32.const 10)
+ (br $inner)
+ )
+ (br $middle)
+ )
+ )
+ )
+ (func $b6 (param $i1 i32)
+ (block $topmost
+ (i32.const 5)
+ (block $inner
+ (i32.const 10)
+ (br $inner)
+ )
+ (i32.const 15)
+ )
+ )
+ (func $b7 (param $i1 i32)
+ (block $topmost
+ (i32.const 3)
+ (block $middle
+ (i32.const 6)
+ (block $inner
+ (i32.const 10)
+ (br $inner)
+ )
+ (i32.const 15)
+ (br $middle)
+ )
+ (i32.const 20)
+ )
+ )
+)
diff --git a/test/passes/merge-blocks.wast b/test/passes/merge-blocks.wast
new file mode 100644
index 000000000..bd58ebc38
--- /dev/null
+++ b/test/passes/merge-blocks.wast
@@ -0,0 +1,86 @@
+(module
+ (memory 16777216 16777216)
+ (func $b0-yes (param $i1 i32)
+ (block $topmost
+ (block
+ (i32.const 10)
+ )
+ )
+ )
+ (func $b1-yes (param $i1 i32)
+ (block $topmost
+ (block
+ (block
+ (i32.const 10)
+ )
+ )
+ )
+ )
+ (func $b2-yes (param $i1 i32)
+ (block $topmost
+ (i32.const 5)
+ (block
+ (i32.const 10)
+ )
+ (i32.const 15)
+ )
+ )
+ (func $b3-yes (param $i1 i32)
+ (block $topmost
+ (i32.const 3)
+ (block
+ (i32.const 6)
+ (block
+ (i32.const 10)
+ )
+ (i32.const 15)
+ )
+ (i32.const 20)
+ )
+ )
+ (func $b4 (param $i1 i32)
+ (block $topmost
+ (block $inner
+ (i32.const 10)
+ (br $inner)
+ )
+ )
+ )
+ (func $b5 (param $i1 i32)
+ (block $topmost
+ (block $middle
+ (block $inner
+ (i32.const 10)
+ (br $inner)
+ )
+ (br $middle)
+ )
+ )
+ )
+ (func $b6 (param $i1 i32)
+ (block $topmost
+ (i32.const 5)
+ (block $inner
+ (i32.const 10)
+ (br $inner)
+ )
+ (i32.const 15)
+ )
+ )
+ (func $b7 (param $i1 i32)
+ (block $topmost
+ (i32.const 3)
+ (block $middle
+ (i32.const 6)
+ (block $inner
+ (i32.const 10)
+ (br $inner)
+ )
+ (i32.const 15)
+ (br $middle)
+ )
+ (i32.const 20)
+ )
+ )
+)
+
diff --git a/test/unit.2asm.js b/test/unit.2asm.js
index 953437f63..ca62fb0d9 100644
--- a/test/unit.2asm.js
+++ b/test/unit.2asm.js
@@ -241,6 +241,16 @@ function asmFunc(global, env, buffer) {
}
+ function block_and_after() {
+ var wasm2asm_i32$0 = 0;
+ waka : {
+ 1;
+ break waka;
+ }
+ wasm2asm_i32$0 = 0;
+ return wasm2asm_i32$0 | 0;
+ }
+
var FUNCTION_TABLE_d = [importedDoubles, importedDoubles, importedDoubles, importedDoubles, importedDoubles, importedDoubles, importedDoubles, importedDoubles, importedDoubles, importedDoubles, importedDoubles, importedDoubles, importedDoubles, importedDoubles, importedDoubles, importedDoubles];
var FUNCTION_TABLE_v = [z, big_negative, z, z, w, w, z, w, z, z, z, z, z, z, z, z];
var FUNCTION_TABLE_vf = [cneg, cneg, cneg, cneg, cneg, cneg, cneg, cneg, cneg, cneg, cneg, cneg, cneg, cneg, cneg, cneg];
diff --git a/test/unit.wast b/test/unit.wast
index 4311a2a33..55c9e9fa1 100644
--- a/test/unit.wast
+++ b/test/unit.wast
@@ -378,4 +378,11 @@
(func $w
(nop)
)
+ (func $block_and_after (result i32)
+ (block $waka
+ (i32.const 1)
+ (br $waka)
+ )
+ (i32.const 0)
+ )
)