diff options
author | Alon Zakai <alonzakai@gmail.com> | 2017-11-16 09:22:57 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-16 09:22:57 -0800 |
commit | dcdaa5de3b2c63a1349faacfe921527d972fc95c (patch) | |
tree | 74c88ccd054b2c419e0c76827e566b8d08f7d5b3 /test | |
parent | 27474b7482ad2673ef3c9aca09aa443769e7447f (diff) | |
download | binaryen-dcdaa5de3b2c63a1349faacfe921527d972fc95c.tar.gz binaryen-dcdaa5de3b2c63a1349faacfe921527d972fc95c.tar.bz2 binaryen-dcdaa5de3b2c63a1349faacfe921527d972fc95c.zip |
Fix if copying (#1278)
* fix if copying - we should preserve the forced explicit type if there is one, and not just infer it from the arms. this adds a builder method for makeIf that receives a type to apply to the if, and for blocks a method that makes a block from a list, also with a variant with a provided type
Diffstat (limited to 'test')
-rw-r--r-- | test/passes/inlining.txt | 31 | ||||
-rw-r--r-- | test/passes/inlining.wast | 29 |
2 files changed, 60 insertions, 0 deletions
diff --git a/test/passes/inlining.txt b/test/passes/inlining.txt index 3fd4e025b..67604971d 100644 --- a/test/passes/inlining.txt +++ b/test/passes/inlining.txt @@ -218,3 +218,34 @@ ) ) ) +(module + (type $T (func (param i32))) + (type $1 (func)) + (table 10 anyfunc) + (memory $0 0) + (func $0 (; 0 ;) (type $1) + (block $__inlined_func$1 + (call_indirect $T + (if (result i32) + (i32.const 0) + (unreachable) + (unreachable) + ) + (i32.const 1) + ) + ) + ) +) +(module + (type $0 (func)) + (memory $0 0) + (func $1 (; 0 ;) (type $0) + (block $__inlined_func$0 + (block $label$1 + (br_table $label$1 $label$1 + (i32.const 0) + ) + ) + ) + ) +) diff --git a/test/passes/inlining.wast b/test/passes/inlining.wast index 38370addf..f68fb6703 100644 --- a/test/passes/inlining.wast +++ b/test/passes/inlining.wast @@ -145,4 +145,33 @@ ) ) ) +(module + (type $T (func (param i32))) + (table 10 anyfunc) + (func $0 + (call $1) + ) + (func $1 + (call_indirect $T + (if (result i32) ;; if copy must preserve the forced type + (i32.const 0) + (unreachable) + (unreachable) + ) + (i32.const 1) + ) + ) +) +(module + (func $0 + (block $label$1 ;; copy this name + (br_table $label$1 $label$1 + (i32.const 0) + ) + ) + ) + (func $1 + (call $0) + ) +) |