summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/passes/merge-blocks.txt78
-rw-r--r--test/passes/merge-blocks.wast57
2 files changed, 135 insertions, 0 deletions
diff --git a/test/passes/merge-blocks.txt b/test/passes/merge-blocks.txt
new file mode 100644
index 000000000..ae34bea05
--- /dev/null
+++ b/test/passes/merge-blocks.txt
@@ -0,0 +1,78 @@
+(module
+ (type $0 (func))
+ (type $1 (func (param i32)))
+ (memory $0 0)
+ (func $drop-block (type $0)
+ (block $block
+ (block $x
+ (drop
+ (i32.const 0)
+ )
+ )
+ )
+ )
+ (func $drop-block-br (type $0)
+ (block $block
+ (block $x
+ (drop
+ (i32.const 1)
+ )
+ (br $x)
+ (drop
+ (i32.const 0)
+ )
+ )
+ )
+ )
+ (func $drop-block-br-if (type $0)
+ (block $block
+ (block $x
+ (drop
+ (i32.const 1)
+ )
+ (br_if $x
+ (i32.const 2)
+ )
+ (drop
+ (i32.const 0)
+ )
+ )
+ )
+ )
+ (func $undroppable-block-br-if (type $1) (param $0 i32)
+ (block $block
+ (drop
+ (block $x i32
+ (call $undroppable-block-br-if
+ (br_if $x
+ (i32.const 1)
+ (i32.const 2)
+ )
+ )
+ (i32.const 0)
+ )
+ )
+ )
+ )
+ (func $drop-block-nested-br-if (type $0)
+ (block $block
+ (block $x
+ (if
+ (i32.const 100)
+ (block $block0
+ (drop
+ (i32.const 1)
+ )
+ (br_if $x
+ (i32.const 2)
+ )
+ (nop)
+ )
+ )
+ (drop
+ (i32.const 0)
+ )
+ )
+ )
+ )
+)
diff --git a/test/passes/merge-blocks.wast b/test/passes/merge-blocks.wast
new file mode 100644
index 000000000..e0da890a1
--- /dev/null
+++ b/test/passes/merge-blocks.wast
@@ -0,0 +1,57 @@
+(module
+ (func $drop-block
+ (block
+ (drop
+ (block $x i32
+ (i32.const 0)
+ )
+ )
+ )
+ )
+ (func $drop-block-br
+ (block
+ (drop
+ (block $x i32
+ (br $x (i32.const 1))
+ (i32.const 0)
+ )
+ )
+ )
+ )
+ (func $drop-block-br-if
+ (block
+ (drop
+ (block $x i32
+ (drop (br_if $x (i32.const 1) (i32.const 2)))
+ (i32.const 0)
+ )
+ )
+ )
+ )
+ (func $undroppable-block-br-if (param i32)
+ (block
+ (drop
+ (block $x i32
+ (call $undroppable-block-br-if (br_if $x (i32.const 1) (i32.const 2)))
+ (i32.const 0)
+ )
+ )
+ )
+ )
+ (func $drop-block-nested-br-if
+ (block
+ (drop
+ (block $x i32
+ (if (i32.const 100)
+ (block
+ (drop (br_if $x (i32.const 1) (i32.const 2)))
+ (nop)
+ )
+ )
+ (i32.const 0)
+ )
+ )
+ )
+ )
+)
+