summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2017-08-24 18:53:06 -0700
committerAlon Zakai <alonzakai@gmail.com>2017-08-25 16:04:35 -0700
commit4367194dc08e981b85effc2127564f53ecbc0af1 (patch)
tree37611c760efa4c9acd86892ad6f4cbb3d917a160 /test
parentdb3adf6c6a6a34bb23f0a91a7fad568dfa906062 (diff)
downloadbinaryen-4367194dc08e981b85effc2127564f53ecbc0af1.tar.gz
binaryen-4367194dc08e981b85effc2127564f53ecbc0af1.tar.bz2
binaryen-4367194dc08e981b85effc2127564f53ecbc0af1.zip
set the type of a set_local properly when it is unreachable
Diffstat (limited to 'test')
-rw-r--r--test/passes/simplify-locals.txt16
-rw-r--r--test/passes/simplify-locals.wast13
2 files changed, 28 insertions, 1 deletions
diff --git a/test/passes/simplify-locals.txt b/test/passes/simplify-locals.txt
index a46f74c69..39fc1d97d 100644
--- a/test/passes/simplify-locals.txt
+++ b/test/passes/simplify-locals.txt
@@ -9,6 +9,7 @@
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
(type $8 (func (param i32 i32)))
(type $9 (func (param i32 i32 i32) (result i32)))
+ (type $10 (func (param i64)))
(import "env" "waka" (func $waka))
(import "env" "waka_int" (func $waka_int (result i32)))
(import "env" "i64sub" (func $_i64Subtract (param i32 i32 i32 i32) (result i32)))
@@ -875,6 +876,21 @@
(get_local $x)
)
)
+ (func $if-return-but-unreachable (type $10) (param $var$0 i64)
+ (tee_local $var$0
+ (if
+ (unreachable)
+ (block (result i64)
+ (nop)
+ (get_local $var$0)
+ )
+ (block (result i64)
+ (nop)
+ (i64.const 1)
+ )
+ )
+ )
+ )
)
(module
(type $FUNCSIG$v (func))
diff --git a/test/passes/simplify-locals.wast b/test/passes/simplify-locals.wast
index 344e0934e..eff5ff6be 100644
--- a/test/passes/simplify-locals.wast
+++ b/test/passes/simplify-locals.wast
@@ -871,6 +871,17 @@
(get_local $x)
)
)
+ (func $if-return-but-unreachable (param $var$0 i64)
+ (if
+ (unreachable)
+ (set_local $var$0
+ (get_local $var$0)
+ )
+ (set_local $var$0
+ (i64.const 1)
+ )
+ )
+ )
)
(module
(memory 256 256 shared)
@@ -929,4 +940,4 @@
(drop (i32.atomic.load (i32.const 1028)))
(drop (get_local $x))
)
-) \ No newline at end of file
+)