diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/passes/O.txt | 18 | ||||
-rw-r--r-- | test/passes/O.wast | 17 | ||||
-rw-r--r-- | test/passes/precompute.txt | 78 | ||||
-rw-r--r-- | test/passes/precompute.wast | 128 |
4 files changed, 240 insertions, 1 deletions
diff --git a/test/passes/O.txt b/test/passes/O.txt new file mode 100644 index 000000000..a70afc81a --- /dev/null +++ b/test/passes/O.txt @@ -0,0 +1,18 @@ +(module + (memory 0) + (type $0 (func (result i32))) + (func $ret (type $0) (result i32) + (block $out i32 + (drop + (call $ret) + ) + (if + (call $ret) + (return + (i32.const 1) + ) + ) + (i32.const 999) + ) + ) +) diff --git a/test/passes/O.wast b/test/passes/O.wast new file mode 100644 index 000000000..8b94d39fc --- /dev/null +++ b/test/passes/O.wast @@ -0,0 +1,17 @@ +(module + (func $ret (result i32) + (block $out + (drop (call $ret)) + (if (call $ret) + (return + (return + (i32.const 1) + ) + ) + ) + (drop (br_if $out (i32.const 999) (i32.const 1))) + (unreachable) + ) + ) +) + diff --git a/test/passes/precompute.txt b/test/passes/precompute.txt index cbf0f23a7..48a6c0f4d 100644 --- a/test/passes/precompute.txt +++ b/test/passes/precompute.txt @@ -1,6 +1,8 @@ (module (memory 0) (type $0 (func (param i32))) + (type $1 (func (result i32))) + (type $2 (func)) (func $x (type $0) (param $x i32) (nop) (drop @@ -21,9 +23,83 @@ (call $x (i32.const 4) ) - (br_if $c + (br $c) + (br $c) + ) + (drop + (block $val i32 + (nop) + (call $x + (i32.const 4) + ) + (br $val + (i32.const 101) + ) + (br $val + (i32.const 102) + ) + ) + ) + (nop) + (drop + (block $d i32 + (call $x + (i32.const 5) + ) + (nop) (i32.const 1) ) ) + (drop + (block $d i32 + (call $x + (i32.const 6) + ) + (nop) + (i32.const 1) + ) + ) + (drop + (block $d i32 + (call $x + (i32.const 7) + ) + (nop) + (i32.const 2) + ) + ) + (call $x + (i32.const 2) + ) + (call $x + (i32.const 1) + ) + (call $x + (i32.const 0) + ) + (call $x + (i32.const 0) + ) + ) + (func $ret (type $1) (result i32) + (if + (call $ret) + (return + (i32.const 0) + ) + ) + (if + (call $ret) + (return + (i32.const 1) + ) + ) + (i32.const 1) + ) + (func $noret (type $2) + (if + (call $ret) + (return) + ) ) ) diff --git a/test/passes/precompute.wast b/test/passes/precompute.wast index e57522578..17b02b336 100644 --- a/test/passes/precompute.wast +++ b/test/passes/precompute.wast @@ -50,6 +50,134 @@ (br_if $c (i32.const 0)) (call $x (i32.const 4)) (br_if $c (i32.const 1)) + (br $c) + ) + (drop + (block $val + (drop (br_if $val (i32.const 100) (i32.const 0))) + (call $x (i32.const 4)) + (drop (br_if $val (i32.const 101) (i32.const 1))) + (br $val (i32.const 102)) + ) + ) + (block $d + (block $e + (br_if $d (br $e)) + (call $x (i32.const 4)) + (br_if $e (br $d)) + ) + ) + (drop + (block $d + (call $x (i32.const 5)) + (block $e + (drop (br_if $d (br $e) (i32.const 1))) + (drop (br_if $d (br $e) (i32.const 0))) + (drop (br_if $d (i32.const 1) (br $e))) + (drop (br_if $d (i32.const 0) (br $e))) + (unreachable) + ) + (i32.const 1) + ) + ) + (drop + (block $d + (call $x (i32.const 6)) + (block $e + (drop (br_if $d (br $e) (i32.const 0))) + (drop (br_if $d (i32.const 1) (br $e))) + (drop (br_if $d (i32.const 0) (br $e))) + (unreachable) + ) + (i32.const 1) + ) + ) + (drop + (block $d + (call $x (i32.const 7)) + (block $e + (drop (br_if $d (i32.const 1) (br $e))) + ) + (i32.const 2) + ) + ) + (call $x + (block $out + (block $waka1 + (block $waka2 + (block $waka3 + (br_table $waka1 $waka2 $waka3 + (i32.const 0) + ) + ) + (br $out (i32.const 0)) + ) + (br $out (i32.const 1)) + ) + (br $out (i32.const 2)) + ) + ) + (call $x + (block $out + (block $waka1 + (block $waka2 + (block $waka3 + (br_table $waka1 $waka2 $waka3 + (i32.const 1) + ) + ) + (br $out (i32.const 0)) + ) + (br $out (i32.const 1)) + ) + (br $out (i32.const 2)) + ) + ) + (call $x + (block $out + (block $waka1 + (block $waka2 + (block $waka3 + (br_table $waka1 $waka2 $waka3 + (i32.const 2) + ) + ) + (br $out (i32.const 0)) + ) + (br $out (i32.const 1)) + ) + (br $out (i32.const 2)) + ) + ) + (call $x + (block $out + (block $waka1 + (block $waka2 + (block $waka3 + (br_table $waka1 $waka2 $waka3 + (i32.const 3) + ) + ) + (br $out (i32.const 0)) + ) + (br $out (i32.const 1)) + ) + (br $out (i32.const 2)) + ) + ) + ) + (func $ret (result i32) + (if (call $ret) + (return (i32.const 0)) + ) + (if (call $ret) + (return (return (i32.const 1))) + ) + (i32.const 1) + ) + (func $noret + (if (call $ret) + (return) ) ) ) |