summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlon Zakai (kripken) <alonzakai@gmail.com>2017-07-10 22:02:31 -0700
committerAlon Zakai (kripken) <alonzakai@gmail.com>2017-07-11 11:07:46 -0700
commite5ebae7cc965f3272e03cf29cc114c638b00eb3a (patch)
treefb7a03f38083d524d433e1bb08f20e514d4a975a /test
parent75162c41b83f67eee967b1d7a1068ba87e17b4eb (diff)
downloadbinaryen-e5ebae7cc965f3272e03cf29cc114c638b00eb3a.tar.gz
binaryen-e5ebae7cc965f3272e03cf29cc114c638b00eb3a.tar.bz2
binaryen-e5ebae7cc965f3272e03cf29cc114c638b00eb3a.zip
fix coalesce-locals handling of set/tee local of an unreachable; we still need the value, as it may do things
Diffstat (limited to 'test')
-rw-r--r--test/passes/coalesce-locals-learning.txt8
-rw-r--r--test/passes/coalesce-locals.txt49
-rw-r--r--test/passes/coalesce-locals.wast10
3 files changed, 55 insertions, 12 deletions
diff --git a/test/passes/coalesce-locals-learning.txt b/test/passes/coalesce-locals-learning.txt
index 3bd04680d..2377c4051 100644
--- a/test/passes/coalesce-locals-learning.txt
+++ b/test/passes/coalesce-locals-learning.txt
@@ -108,11 +108,15 @@
)
(block $block
(br $block)
- (nop)
(drop
(i32.const 0)
)
- (nop)
+ (drop
+ (i32.const 0)
+ )
+ (drop
+ (i32.const -1)
+ )
)
(drop
(get_local $0)
diff --git a/test/passes/coalesce-locals.txt b/test/passes/coalesce-locals.txt
index 8f2908153..f8dc3ef0f 100644
--- a/test/passes/coalesce-locals.txt
+++ b/test/passes/coalesce-locals.txt
@@ -6,6 +6,7 @@
(type $4 (func (param i32)))
(type $FUNCSIG$i (func (result i32)))
(type $FUNCSIG$vi (func (param i32)))
+ (type $7 (func (param i32) (result i32)))
(import "env" "_emscripten_autodebug_i32" (func $_emscripten_autodebug_i32 (param i32 i32) (result i32)))
(import "env" "get" (func $get (result i32)))
(import "env" "set" (func $set (param i32)))
@@ -112,11 +113,15 @@
)
(block $block
(br $block)
- (nop)
(drop
(i32.const 0)
)
- (nop)
+ (drop
+ (i32.const 0)
+ )
+ (drop
+ (i32.const -1)
+ )
)
(drop
(get_local $0)
@@ -902,37 +907,53 @@
(local $0 i32)
(block $x
(return)
- (nop)
+ (drop
+ (i32.const 1)
+ )
+ (drop
+ (i32.const 0)
+ )
(drop
(i32.const 0)
)
- (nop)
)
(block $y
(unreachable)
- (nop)
+ (drop
+ (i32.const 1)
+ )
+ (drop
+ (i32.const 0)
+ )
(drop
(i32.const 0)
)
- (nop)
)
(block $z
(br $z)
- (nop)
+ (drop
+ (i32.const 1)
+ )
+ (drop
+ (i32.const 0)
+ )
(drop
(i32.const 0)
)
- (nop)
)
(block $z14
(br_table $z14 $z14
(i32.const 100)
)
- (nop)
+ (drop
+ (i32.const 1)
+ )
+ (drop
+ (i32.const 0)
+ )
(drop
(i32.const 0)
)
- (nop)
)
)
(func $nop-in-unreachable (type $2)
@@ -1083,4 +1104,12 @@
(br $top)
)
)
+ (func $tee_br (type $7) (param $0 i32) (result i32)
+ (block $b
+ (return
+ (br $b)
+ )
+ )
+ (i32.const 1)
+ )
)
diff --git a/test/passes/coalesce-locals.wast b/test/passes/coalesce-locals.wast
index d6d499d36..336c75e0e 100644
--- a/test/passes/coalesce-locals.wast
+++ b/test/passes/coalesce-locals.wast
@@ -1075,4 +1075,14 @@
(br $top)
)
)
+ (func $tee_br (param $x i32) (result i32)
+ (block $b
+ (return
+ (tee_local $x
+ (br $b)
+ )
+ )
+ )
+ (i32.const 1)
+ )
)