summaryrefslogtreecommitdiff
path: root/test/passes/remove-unused-brs.txt
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2017-09-05 19:26:19 -0700
committerGitHub <noreply@github.com>2017-09-05 19:26:19 -0700
commitc0f21e10a1166829afd34c4fb06366d7430802bb (patch)
tree518bbe8c8746679b3adf678940e52158e77b5ede /test/passes/remove-unused-brs.txt
parent4f58e1e666cff6f1e61d888279dba42d1be14251 (diff)
downloadbinaryen-c0f21e10a1166829afd34c4fb06366d7430802bb.tar.gz
binaryen-c0f21e10a1166829afd34c4fb06366d7430802bb.tar.bz2
binaryen-c0f21e10a1166829afd34c4fb06366d7430802bb.zip
Return to more structured type rules for block and if (#1148)
* if a block has a concrete final element (or a break with a value), then even if it has an unreachable child, keep it with that concrete type. this means we no longe allow the silly case of a block with an unreachable in the middle and a concrete as the final element while the block is unreachable - after this change, the block would have the type of the final element * if an if has a concrete element in one arm, make it have that type as a result, even if the if condition is unreachable, to parallel block * make type rules for brs and switches simpler, ignore whether they are reachable or not. whether they are dead code should not affect how they influence other types in our IR.
Diffstat (limited to 'test/passes/remove-unused-brs.txt')
-rw-r--r--test/passes/remove-unused-brs.txt44
1 files changed, 30 insertions, 14 deletions
diff --git a/test/passes/remove-unused-brs.txt b/test/passes/remove-unused-brs.txt
index 7951cf18f..6991680f7 100644
--- a/test/passes/remove-unused-brs.txt
+++ b/test/passes/remove-unused-brs.txt
@@ -332,7 +332,7 @@
)
)
(if
- (block $block6
+ (block $block6 (result i32)
(block $block15
(drop
(i32.const 2)
@@ -1037,11 +1037,23 @@
)
)
)
- (func $untaken-br-with-concrete-last-element (type $2) (result i32)
- (block $label$8 (result i32)
- (block $label$11 (result i32)
+ (func $untaken-br-with-concrete-last-element (type $1)
+ (block $label$8
+ (block $label$11
(block $label$14
(br_if $label$8
+ (br $label$8)
+ )
+ )
+ )
+ )
+ )
+ (func $untaken-br-with-concrete-last-element2 (type $2) (result i32)
+ (block $label$8 (result i32)
+ (block $label$11 (result i32)
+ (block $label$14 (result i32)
+ (br_if $label$14
+ (i32.const 102)
(br $label$11
(i32.const 103)
)
@@ -1062,25 +1074,29 @@
)
)
(func $unreachable-if-that-could-be-a-br_if (type $7) (result i64)
- (loop $label$3
- (if
- (unreachable)
- (f64.const 1)
- (br $label$3)
+ (loop $label$3 (result i64)
+ (drop
+ (if (result f64)
+ (unreachable)
+ (f64.const 1)
+ (br $label$3)
+ )
)
(i64.const 1)
)
)
(func $nop-br-might-update-type (type $1)
(block $label$39
- (if
- (unreachable)
+ (drop
(if (result i32)
- (i32.const 1)
- (br $label$39)
+ (unreachable)
+ (if (result i32)
+ (i32.const 1)
+ (br $label$39)
+ (i32.const 0)
+ )
(i32.const 0)
)
- (i32.const 0)
)
)
)