summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-10-29 15:46:42 -0700
committerGitHub <noreply@github.com>2016-10-29 15:46:42 -0700
commitadc568e7d0bde50419a0bae8a96f7dbb0f69cf4d (patch)
treef2a231d3534904fadbe73b45f9bcb92303936da3 /test
parent1cdee58fed2479997c1e386236879be87036d60c (diff)
parent73a2bae85261757303deb9e3ff5be230483d5ba4 (diff)
downloadbinaryen-adc568e7d0bde50419a0bae8a96f7dbb0f69cf4d.tar.gz
binaryen-adc568e7d0bde50419a0bae8a96f7dbb0f69cf4d.tar.bz2
binaryen-adc568e7d0bde50419a0bae8a96f7dbb0f69cf4d.zip
Merge pull request #813 from WebAssembly/fix-mergeblocks-drop-br-if
Fix mergeblocks drop br if
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)
+ )
+ )
+ )
+ )
+)
+