diff options
author | Alon Zakai <azakai@google.com> | 2022-08-22 13:53:47 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-22 13:53:47 -0700 |
commit | 38c084ee386e257389d44c6200a403f74432e1af (patch) | |
tree | 8e41abd3ad903b9fcb426bf0c4be3dd66a092247 /test/passes/remove-unused-brs_enable-multivalue.txt | |
parent | b24df4d0c4705027fdc6e261aa3f8e4f61dc5c0a (diff) | |
download | binaryen-38c084ee386e257389d44c6200a403f74432e1af.tar.gz binaryen-38c084ee386e257389d44c6200a403f74432e1af.tar.bz2 binaryen-38c084ee386e257389d44c6200a403f74432e1af.zip |
Avoid adding new unneeded names to blocks in text roundtripping (#4943)
Previously the wat parser would turn this input:
(block
(nop)
)
into something like this:
(block $block17
(nop)
)
It just added a name all the time, in case the block is referred to by an index
later even though it doesn't have a name.
This PR makes us rountrip more precisely by not adding such names: if there
was no name before, and there is no break by index, then do not add a name.
In addition, this will be useful for non-nullable locals since whether a block has
a name or not matters there. Like #4912, this makes us more regular in our
usage of block names.
Diffstat (limited to 'test/passes/remove-unused-brs_enable-multivalue.txt')
-rw-r--r-- | test/passes/remove-unused-brs_enable-multivalue.txt | 97 |
1 files changed, 51 insertions, 46 deletions
diff --git a/test/passes/remove-unused-brs_enable-multivalue.txt b/test/passes/remove-unused-brs_enable-multivalue.txt index cf8ad7ec2..8240bba22 100644 --- a/test/passes/remove-unused-brs_enable-multivalue.txt +++ b/test/passes/remove-unused-brs_enable-multivalue.txt @@ -19,10 +19,11 @@ ) (func $b1 (param $i1 i32) (block $topmost - (block $block + (block (drop (i32.const 0) ) + (nop) ) ) ) @@ -41,10 +42,11 @@ (func $b4 (param $i1 i32) (block $topmost (block $inner - (block $block + (block (drop (i32.const 0) ) + (nop) ) ) ) @@ -52,10 +54,11 @@ (func $b5 (param $i1 i32) (block $topmost (block $inner - (block $block + (block (drop (i32.const 0) ) + (nop) ) ) ) @@ -69,7 +72,7 @@ ) (func $b7 (param $i1 i32) (block $topmost - (block $block + (block (drop (i32.const 0) ) @@ -100,7 +103,7 @@ (func $b10 (param $i1 i32) (block $topmost (block $inner - (block $block + (block (drop (i32.const 0) ) @@ -114,7 +117,7 @@ (func $b11 (param $i1 i32) (block $topmost (block $inner - (block $block + (block (drop (i32.const 0) ) @@ -133,10 +136,11 @@ (drop (i32.const 12) ) - (block $block + (block (drop (i32.const 1) ) + (nop) ) ) ) @@ -144,10 +148,11 @@ (drop (i32.const 27) ) - (block $block0 + (block (drop (i32.const 2) ) + (nop) ) ) ) @@ -222,10 +227,11 @@ (if (i32.const 18) (block $topmost - (block $block + (block (drop (i32.const 0) ) + (nop) ) ) ) @@ -325,7 +331,7 @@ (i32.const 1) ) (block $block2 - (block $block + (block (drop (i32.const 2) ) @@ -339,7 +345,7 @@ (if (i32.const 0) (block $block4 - (block $block13 + (block (drop (i32.const 2) ) @@ -355,7 +361,7 @@ ) (if (block $block6 (result i32) - (block $block15 + (block (drop (i32.const 2) ) @@ -375,17 +381,19 @@ (i32.const 0) ) (block $a18 - (block $block19 + (block (drop (i32.const 1) ) + (nop) ) ) (block $a20 - (block $block21 + (block (drop (i32.const 2) ) + (nop) ) ) ) @@ -396,7 +404,7 @@ (block $do-once$0 (if (call $b13) - (block $block + (block (drop (i32.const 0) ) @@ -410,7 +418,7 @@ (block $do-once$022 (if (call $b13) - (block $block24 + (block (drop (call $b14) ) @@ -424,7 +432,7 @@ (block $do-once$025 (if (i32.const 0) - (block $block27 + (block (drop (call $b14) ) @@ -516,8 +524,9 @@ (if (i32.const 0) (block $out49 - (block $block + (block (call $loops) + (nop) ) ) (br $in48) @@ -560,12 +569,10 @@ (if (i32.const 0) (block - (block $block61 - (drop - (i32.const 1) - ) - (call $loops) + (drop + (i32.const 1) ) + (call $loops) (br $in58) ) (block $out59 @@ -604,12 +611,10 @@ (if (i32.const 0) (block - (block $block71 - (drop - (i32.const 1) - ) - (call $loops) + (drop + (i32.const 1) ) + (call $loops) (drop (i32.const 102) ) @@ -794,7 +799,7 @@ (if (local.get $x) (br $out - (block $block (result i32) + (block (result i32) (local.set $x (i32.const 0) ) @@ -824,7 +829,7 @@ (i32.const 1) ) (br $out - (block $block (result i32) + (block (result i32) (local.set $x (i32.const 0) ) @@ -848,7 +853,7 @@ (if (local.get $x) (br $out - (block $block (result i32) + (block (result i32) (drop (call $if-to-br_if-value-sideeffect (i32.const 0) @@ -963,7 +968,7 @@ (i32.const 2) ) ) - (block $block (result i32) + (block (result i32) (drop (call $loop-if) ) @@ -2120,7 +2125,7 @@ (if (i32.const 1) (block $label - (block $block + (block (drop (i32.const 2) ) @@ -2135,7 +2140,7 @@ (block $label (if (br $label) - (block $block + (block (drop (i32.const 2) ) @@ -2234,7 +2239,7 @@ (if (i32.const 1) (nop) - (block $block + (block (drop (loop $label$3 (result i64) (br_if $label$3 @@ -2320,7 +2325,9 @@ (if (i32.const 0) (block $label$3 - (block $block + (block + (nop) + (nop) ) ) (return @@ -2604,17 +2611,15 @@ ) ) (func $do-not-flow-values-through-unreachable-code (result i32) - (block $block - (unreachable) - (if - (i32.const 0) - (block $A - (return - (i32.const 0) - ) + (unreachable) + (if + (i32.const 0) + (block $A + (return + (i32.const 0) ) - (nop) ) + (nop) ) ) (func $do-not-flow-values-through-unreachable-code-b (result i32) @@ -2692,7 +2697,7 @@ ) (i32.const 3) ) - (block $block (result i32) + (block (result i32) (if (local.get $x) (return |