diff options
-rw-r--r-- | src/passes/RemoveUnusedBrs.cpp | 16 | ||||
-rw-r--r-- | src/passes/pass.cpp | 3 | ||||
-rw-r--r-- | test/emcc_hello_world.fromasm | 674 | ||||
-rw-r--r-- | test/emcc_hello_world.fromasm.clamp | 674 | ||||
-rw-r--r-- | test/emcc_hello_world.fromasm.imprecise | 772 | ||||
-rw-r--r-- | test/example/relooper-fuzz.txt | 22 | ||||
-rw-r--r-- | test/passes/O.bin.txt | 34 | ||||
-rw-r--r-- | test/passes/remove-unused-brs.txt | 41 | ||||
-rw-r--r-- | test/passes/remove-unused-brs.wast | 19 | ||||
-rw-r--r-- | test/unit.fromasm | 37 | ||||
-rw-r--r-- | test/unit.fromasm.clamp | 37 | ||||
-rw-r--r-- | test/unit.fromasm.imprecise | 37 | ||||
-rw-r--r-- | test/wasm-only.fromasm | 1 | ||||
-rw-r--r-- | test/wasm-only.fromasm.clamp | 1 | ||||
-rw-r--r-- | test/wasm-only.fromasm.imprecise | 1 |
15 files changed, 1169 insertions, 1200 deletions
diff --git a/src/passes/RemoveUnusedBrs.cpp b/src/passes/RemoveUnusedBrs.cpp index 434b8a4bd..785b1c92e 100644 --- a/src/passes/RemoveUnusedBrs.cpp +++ b/src/passes/RemoveUnusedBrs.cpp @@ -122,6 +122,8 @@ struct RemoveUnusedBrs : public WalkerPass<PostWalker<RemoveUnusedBrs>> { } else if (curr->is<Nop>()) { // ignore (could be result of a previous cycle) self->valueCanFlow = false; + } else if (curr->is<Loop>()) { + // do nothing - it's ok for values to flow out } else { // anything else stops the flow flows.clear(); @@ -323,10 +325,7 @@ struct RemoveUnusedBrs : public WalkerPass<PostWalker<RemoveUnusedBrs>> { // map of all value-less breaks going to a block (and not a loop) std::map<Block*, std::vector<Break*>> breaksToBlock; - // number of definitions of each name - when a name is defined more than once, it is not trivially safe to do this - std::map<Name, Index> numDefs; - - // the names to update, when we can (just one def) + // the names to update std::map<Break*, Name> newNames; void visitBreak(Break* curr) { @@ -338,8 +337,6 @@ struct RemoveUnusedBrs : public WalkerPass<PostWalker<RemoveUnusedBrs>> { } // TODO: Switch? void visitBlock(Block* curr) { - if (curr->name.is()) numDefs[curr->name]++; - auto& list = curr->list; if (list.size() == 1 && curr->name.is()) { // if this block has just one child, a sub-block, then jumps to the former are jumps to us, really @@ -372,17 +369,12 @@ struct RemoveUnusedBrs : public WalkerPass<PostWalker<RemoveUnusedBrs>> { } } } - void visitLoop(Loop* curr) { - if (curr->name.is()) numDefs[curr->name]++; - } void finish() { for (auto& iter : newNames) { auto* br = iter.first; auto name = iter.second; - if (numDefs[name] == 1) { - br->name = name; - } + br->name = name; } } }; diff --git a/src/passes/pass.cpp b/src/passes/pass.cpp index 50c8da46b..92ab694e0 100644 --- a/src/passes/pass.cpp +++ b/src/passes/pass.cpp @@ -135,8 +135,9 @@ void PassRunner::addDefaultFunctionOptimizationPasses() { add("simplify-locals"); add("vacuum"); // previous pass creates garbage add("reorder-locals"); + add("merge-blocks"); // makes remove-unused-brs more effective add("remove-unused-brs"); // coalesce-locals opens opportunities for optimizations - add("merge-blocks"); + add("merge-blocks"); // clean up remove-unused-brs new blocks add("optimize-instructions"); add("precompute"); if (options.shrinkLevel >= 2) { diff --git a/test/emcc_hello_world.fromasm b/test/emcc_hello_world.fromasm index 772038345..5032cd047 100644 --- a/test/emcc_hello_world.fromasm +++ b/test/emcc_hello_world.fromasm @@ -1831,94 +1831,91 @@ ) (block $label$break$L8 (block $__rjti$2 - (block $__rjti$1 - (if - (i32.and - (tee_local $4 - (i32.ne - (get_local $2) - (i32.const 0) - ) - ) + (if + (i32.and + (tee_local $4 (i32.ne - (i32.and - (get_local $0) - (i32.const 3) - ) + (get_local $2) (i32.const 0) ) ) - (block - (set_local $4 - (i32.and - (get_local $1) - (i32.const 255) - ) - ) - (set_local $3 - (get_local $2) - ) - (set_local $2 + (i32.ne + (i32.and (get_local $0) + (i32.const 3) ) - (loop $while-in - (if - (i32.eq - (i32.load8_u - (get_local $2) - ) - (i32.and - (get_local $4) - (i32.const 255) - ) + (i32.const 0) + ) + ) + (block + (set_local $4 + (i32.and + (get_local $1) + (i32.const 255) + ) + ) + (set_local $3 + (get_local $2) + ) + (set_local $2 + (get_local $0) + ) + (loop $while-in + (if + (i32.eq + (i32.load8_u + (get_local $2) ) - (block - (set_local $0 - (get_local $3) - ) - (br $__rjti$2) + (i32.and + (get_local $4) + (i32.const 255) ) ) - (br_if $while-in - (i32.and - (tee_local $0 - (i32.ne - (tee_local $3 - (i32.add - (get_local $3) - (i32.const -1) - ) + (block + (set_local $0 + (get_local $3) + ) + (br $__rjti$2) + ) + ) + (br_if $while-in + (i32.and + (tee_local $0 + (i32.ne + (tee_local $3 + (i32.add + (get_local $3) + (i32.const -1) ) - (i32.const 0) ) + (i32.const 0) ) - (i32.ne - (i32.and - (tee_local $2 - (i32.add - (get_local $2) - (i32.const 1) - ) + ) + (i32.ne + (i32.and + (tee_local $2 + (i32.add + (get_local $2) + (i32.const 1) ) - (i32.const 3) ) - (i32.const 0) + (i32.const 3) ) + (i32.const 0) ) ) - (br $__rjti$1) ) ) - (block - (set_local $3 - (get_local $2) - ) - (set_local $2 - (get_local $0) - ) - (set_local $0 - (get_local $4) - ) + ) + (block + (set_local $3 + (get_local $2) + ) + (set_local $2 + (get_local $0) + ) + (set_local $0 + (get_local $4) ) ) ) @@ -9260,112 +9257,110 @@ ) (block $__rjto$3 (block $__rjti$3 - (block $__rjti$2 - (if - (tee_local $0 - (i32.load offset=480 - (i32.shl - (get_local $14) - (i32.const 2) - ) + (if + (tee_local $0 + (i32.load offset=480 + (i32.shl + (get_local $14) + (i32.const 2) ) ) - (block - (set_local $6 - (i32.const 0) - ) - (set_local $8 - (i32.shl - (get_local $2) - (select - (i32.const 0) - (i32.sub - (i32.const 25) - (i32.shr_u - (get_local $14) - (i32.const 1) - ) - ) - (i32.eq + ) + (block + (set_local $6 + (i32.const 0) + ) + (set_local $8 + (i32.shl + (get_local $2) + (select + (i32.const 0) + (i32.sub + (i32.const 25) + (i32.shr_u (get_local $14) - (i32.const 31) + (i32.const 1) ) ) + (i32.eq + (get_local $14) + (i32.const 31) + ) ) ) - (set_local $1 - (i32.const 0) - ) - (loop $while-in14 - (if - (i32.lt_u - (tee_local $4 - (i32.sub - (tee_local $9 - (i32.and - (i32.load offset=4 - (get_local $0) - ) - (i32.const -8) + ) + (set_local $1 + (i32.const 0) + ) + (loop $while-in14 + (if + (i32.lt_u + (tee_local $4 + (i32.sub + (tee_local $9 + (i32.and + (i32.load offset=4 + (get_local $0) ) + (i32.const -8) ) - (get_local $2) ) + (get_local $2) ) - (get_local $3) ) - (if - (i32.eq - (get_local $9) - (get_local $2) + (get_local $3) + ) + (if + (i32.eq + (get_local $9) + (get_local $2) + ) + (block + (set_local $1 + (get_local $4) ) - (block - (set_local $1 - (get_local $4) - ) - (set_local $3 - (get_local $0) - ) - (br $__rjti$3) + (set_local $3 + (get_local $0) ) - (block - (set_local $3 - (get_local $4) - ) - (set_local $1 - (get_local $0) - ) + (br $__rjti$3) + ) + (block + (set_local $3 + (get_local $4) + ) + (set_local $1 + (get_local $0) ) ) ) - (set_local $0 - (select - (get_local $6) - (tee_local $4 - (i32.load offset=20 - (get_local $0) - ) + ) + (set_local $0 + (select + (get_local $6) + (tee_local $4 + (i32.load offset=20 + (get_local $0) ) - (i32.or - (i32.eqz - (get_local $4) - ) - (i32.eq - (get_local $4) - (tee_local $9 - (i32.load + ) + (i32.or + (i32.eqz + (get_local $4) + ) + (i32.eq + (get_local $4) + (tee_local $9 + (i32.load + (i32.add (i32.add - (i32.add - (get_local $0) - (i32.const 16) - ) - (i32.shl - (i32.shr_u - (get_local $8) - (i32.const 31) - ) - (i32.const 2) + (get_local $0) + (i32.const 16) + ) + (i32.shl + (i32.shr_u + (get_local $8) + (i32.const 31) ) + (i32.const 2) ) ) ) @@ -9373,52 +9368,51 @@ ) ) ) - (set_local $4 - (i32.shl - (get_local $8) - (i32.xor - (tee_local $6 - (i32.eqz - (get_local $9) - ) + ) + (set_local $4 + (i32.shl + (get_local $8) + (i32.xor + (tee_local $6 + (i32.eqz + (get_local $9) ) - (i32.const 1) ) + (i32.const 1) ) ) - (if - (get_local $6) - (block - (set_local $4 - (get_local $0) - ) - (set_local $0 - (get_local $1) - ) - (br $__rjti$2) + ) + (if + (get_local $6) + (block + (set_local $4 + (get_local $0) ) - (block - (set_local $6 - (get_local $0) - ) - (set_local $8 - (get_local $4) - ) - (set_local $0 - (get_local $9) - ) - (br $while-in14) + (set_local $0 + (get_local $1) + ) + ) + (block + (set_local $6 + (get_local $0) + ) + (set_local $8 + (get_local $4) + ) + (set_local $0 + (get_local $9) ) + (br $while-in14) ) ) ) - (block - (set_local $4 - (i32.const 0) - ) - (set_local $0 - (i32.const 0) - ) + ) + (block + (set_local $4 + (i32.const 0) + ) + (set_local $0 + (i32.const 0) ) ) ) @@ -10345,55 +10339,53 @@ ) (block $__rjto$1 (block $__rjti$1 - (block $__rjti$0 - (loop $while-in28 - (br_if $__rjti$1 - (i32.eq - (i32.and - (i32.load offset=4 - (get_local $0) - ) - (i32.const -8) + (loop $while-in28 + (br_if $__rjti$1 + (i32.eq + (i32.and + (i32.load offset=4 + (get_local $0) ) - (get_local $3) + (i32.const -8) ) + (get_local $3) ) - (set_local $2 - (i32.shl - (get_local $7) - (i32.const 1) - ) + ) + (set_local $2 + (i32.shl + (get_local $7) + (i32.const 1) ) - (br_if $__rjti$0 - (i32.eqz - (tee_local $1 - (i32.load - (tee_local $7 - (i32.add - (i32.add - (get_local $0) - (i32.const 16) - ) - (i32.shl - (i32.shr_u - (get_local $7) - (i32.const 31) - ) - (i32.const 2) - ) + ) + (if + (tee_local $1 + (i32.load + (tee_local $7 + (i32.add + (i32.add + (get_local $0) + (i32.const 16) + ) + (i32.shl + (i32.shr_u + (get_local $7) + (i32.const 31) ) + (i32.const 2) ) ) ) ) ) - (set_local $7 - (get_local $2) - ) - (set_local $0 - (get_local $1) + (block + (set_local $7 + (get_local $2) + ) + (set_local $0 + (get_local $1) + ) + (br $while-in28) ) - (br $while-in28) ) ) (if @@ -12385,55 +12377,53 @@ ) (block $__rjto$7 (block $__rjti$7 - (block $__rjti$6 - (loop $while-in68 - (br_if $__rjti$7 - (i32.eq - (i32.and - (i32.load offset=4 - (get_local $0) - ) - (i32.const -8) + (loop $while-in68 + (br_if $__rjti$7 + (i32.eq + (i32.and + (i32.load offset=4 + (get_local $0) ) - (get_local $7) + (i32.const -8) ) + (get_local $7) ) - (set_local $3 - (i32.shl - (get_local $2) - (i32.const 1) - ) + ) + (set_local $3 + (i32.shl + (get_local $2) + (i32.const 1) ) - (br_if $__rjti$6 - (i32.eqz - (tee_local $1 - (i32.load - (tee_local $2 - (i32.add - (i32.add - (get_local $0) - (i32.const 16) - ) - (i32.shl - (i32.shr_u - (get_local $2) - (i32.const 31) - ) - (i32.const 2) - ) + ) + (if + (tee_local $1 + (i32.load + (tee_local $2 + (i32.add + (i32.add + (get_local $0) + (i32.const 16) + ) + (i32.shl + (i32.shr_u + (get_local $2) + (i32.const 31) ) + (i32.const 2) ) ) ) ) ) - (set_local $2 - (get_local $3) - ) - (set_local $0 - (get_local $1) + (block + (set_local $2 + (get_local $3) + ) + (set_local $0 + (get_local $1) + ) + (br $while-in68) ) - (br $while-in68) ) ) (if @@ -13061,55 +13051,53 @@ ) (block $__rjto$9 (block $__rjti$9 - (block $__rjti$8 - (loop $while-in74 - (br_if $__rjti$9 - (i32.eq - (i32.and - (i32.load offset=4 - (get_local $1) - ) - (i32.const -8) + (loop $while-in74 + (br_if $__rjti$9 + (i32.eq + (i32.and + (i32.load offset=4 + (get_local $1) ) - (get_local $5) + (i32.const -8) ) + (get_local $5) ) - (set_local $2 - (i32.shl - (get_local $4) - (i32.const 1) - ) + ) + (set_local $2 + (i32.shl + (get_local $4) + (i32.const 1) ) - (br_if $__rjti$8 - (i32.eqz - (tee_local $3 - (i32.load - (tee_local $4 - (i32.add - (i32.add - (get_local $1) - (i32.const 16) - ) - (i32.shl - (i32.shr_u - (get_local $4) - (i32.const 31) - ) - (i32.const 2) - ) + ) + (if + (tee_local $3 + (i32.load + (tee_local $4 + (i32.add + (i32.add + (get_local $1) + (i32.const 16) + ) + (i32.shl + (i32.shr_u + (get_local $4) + (i32.const 31) ) + (i32.const 2) ) ) ) ) ) - (set_local $4 - (get_local $2) - ) - (set_local $1 - (get_local $3) + (block + (set_local $4 + (get_local $2) + ) + (set_local $1 + (get_local $3) + ) + (br $while-in74) ) - (br $while-in74) ) ) (if @@ -14989,55 +14977,53 @@ ) (block $__rjto$1 (block $__rjti$1 - (block $__rjti$0 - (loop $while-in15 - (br_if $__rjti$1 - (i32.eq - (i32.and - (i32.load offset=4 - (get_local $0) - ) - (i32.const -8) + (loop $while-in15 + (br_if $__rjti$1 + (i32.eq + (i32.and + (i32.load offset=4 + (get_local $0) ) - (get_local $3) + (i32.const -8) ) + (get_local $3) ) - (set_local $4 - (i32.shl - (get_local $5) - (i32.const 1) - ) + ) + (set_local $4 + (i32.shl + (get_local $5) + (i32.const 1) ) - (br_if $__rjti$0 - (i32.eqz - (tee_local $1 - (i32.load - (tee_local $5 - (i32.add - (i32.add - (get_local $0) - (i32.const 16) - ) - (i32.shl - (i32.shr_u - (get_local $5) - (i32.const 31) - ) - (i32.const 2) - ) + ) + (if + (tee_local $1 + (i32.load + (tee_local $5 + (i32.add + (i32.add + (get_local $0) + (i32.const 16) + ) + (i32.shl + (i32.shr_u + (get_local $5) + (i32.const 31) ) + (i32.const 2) ) ) ) ) ) - (set_local $5 - (get_local $4) - ) - (set_local $0 - (get_local $1) + (block + (set_local $5 + (get_local $4) + ) + (set_local $0 + (get_local $1) + ) + (br $while-in15) ) - (br $while-in15) ) ) (if diff --git a/test/emcc_hello_world.fromasm.clamp b/test/emcc_hello_world.fromasm.clamp index 7bd14d533..944dc27e2 100644 --- a/test/emcc_hello_world.fromasm.clamp +++ b/test/emcc_hello_world.fromasm.clamp @@ -1829,94 +1829,91 @@ ) (block $label$break$L8 (block $__rjti$2 - (block $__rjti$1 - (if - (i32.and - (tee_local $4 - (i32.ne - (get_local $2) - (i32.const 0) - ) - ) + (if + (i32.and + (tee_local $4 (i32.ne - (i32.and - (get_local $0) - (i32.const 3) - ) + (get_local $2) (i32.const 0) ) ) - (block - (set_local $4 - (i32.and - (get_local $1) - (i32.const 255) - ) - ) - (set_local $3 - (get_local $2) - ) - (set_local $2 + (i32.ne + (i32.and (get_local $0) + (i32.const 3) ) - (loop $while-in - (if - (i32.eq - (i32.load8_u - (get_local $2) - ) - (i32.and - (get_local $4) - (i32.const 255) - ) + (i32.const 0) + ) + ) + (block + (set_local $4 + (i32.and + (get_local $1) + (i32.const 255) + ) + ) + (set_local $3 + (get_local $2) + ) + (set_local $2 + (get_local $0) + ) + (loop $while-in + (if + (i32.eq + (i32.load8_u + (get_local $2) ) - (block - (set_local $0 - (get_local $3) - ) - (br $__rjti$2) + (i32.and + (get_local $4) + (i32.const 255) ) ) - (br_if $while-in - (i32.and - (tee_local $0 - (i32.ne - (tee_local $3 - (i32.add - (get_local $3) - (i32.const -1) - ) + (block + (set_local $0 + (get_local $3) + ) + (br $__rjti$2) + ) + ) + (br_if $while-in + (i32.and + (tee_local $0 + (i32.ne + (tee_local $3 + (i32.add + (get_local $3) + (i32.const -1) ) - (i32.const 0) ) + (i32.const 0) ) - (i32.ne - (i32.and - (tee_local $2 - (i32.add - (get_local $2) - (i32.const 1) - ) + ) + (i32.ne + (i32.and + (tee_local $2 + (i32.add + (get_local $2) + (i32.const 1) ) - (i32.const 3) ) - (i32.const 0) + (i32.const 3) ) + (i32.const 0) ) ) - (br $__rjti$1) ) ) - (block - (set_local $3 - (get_local $2) - ) - (set_local $2 - (get_local $0) - ) - (set_local $0 - (get_local $4) - ) + ) + (block + (set_local $3 + (get_local $2) + ) + (set_local $2 + (get_local $0) + ) + (set_local $0 + (get_local $4) ) ) ) @@ -9284,112 +9281,110 @@ ) (block $__rjto$3 (block $__rjti$3 - (block $__rjti$2 - (if - (tee_local $0 - (i32.load offset=480 - (i32.shl - (get_local $14) - (i32.const 2) - ) + (if + (tee_local $0 + (i32.load offset=480 + (i32.shl + (get_local $14) + (i32.const 2) ) ) - (block - (set_local $6 - (i32.const 0) - ) - (set_local $8 - (i32.shl - (get_local $2) - (select - (i32.const 0) - (i32.sub - (i32.const 25) - (i32.shr_u - (get_local $14) - (i32.const 1) - ) - ) - (i32.eq + ) + (block + (set_local $6 + (i32.const 0) + ) + (set_local $8 + (i32.shl + (get_local $2) + (select + (i32.const 0) + (i32.sub + (i32.const 25) + (i32.shr_u (get_local $14) - (i32.const 31) + (i32.const 1) ) ) + (i32.eq + (get_local $14) + (i32.const 31) + ) ) ) - (set_local $1 - (i32.const 0) - ) - (loop $while-in14 - (if - (i32.lt_u - (tee_local $4 - (i32.sub - (tee_local $9 - (i32.and - (i32.load offset=4 - (get_local $0) - ) - (i32.const -8) + ) + (set_local $1 + (i32.const 0) + ) + (loop $while-in14 + (if + (i32.lt_u + (tee_local $4 + (i32.sub + (tee_local $9 + (i32.and + (i32.load offset=4 + (get_local $0) ) + (i32.const -8) ) - (get_local $2) ) + (get_local $2) ) - (get_local $3) ) - (if - (i32.eq - (get_local $9) - (get_local $2) + (get_local $3) + ) + (if + (i32.eq + (get_local $9) + (get_local $2) + ) + (block + (set_local $1 + (get_local $4) ) - (block - (set_local $1 - (get_local $4) - ) - (set_local $3 - (get_local $0) - ) - (br $__rjti$3) + (set_local $3 + (get_local $0) ) - (block - (set_local $3 - (get_local $4) - ) - (set_local $1 - (get_local $0) - ) + (br $__rjti$3) + ) + (block + (set_local $3 + (get_local $4) + ) + (set_local $1 + (get_local $0) ) ) ) - (set_local $0 - (select - (get_local $6) - (tee_local $4 - (i32.load offset=20 - (get_local $0) - ) + ) + (set_local $0 + (select + (get_local $6) + (tee_local $4 + (i32.load offset=20 + (get_local $0) ) - (i32.or - (i32.eqz - (get_local $4) - ) - (i32.eq - (get_local $4) - (tee_local $9 - (i32.load + ) + (i32.or + (i32.eqz + (get_local $4) + ) + (i32.eq + (get_local $4) + (tee_local $9 + (i32.load + (i32.add (i32.add - (i32.add - (get_local $0) - (i32.const 16) - ) - (i32.shl - (i32.shr_u - (get_local $8) - (i32.const 31) - ) - (i32.const 2) + (get_local $0) + (i32.const 16) + ) + (i32.shl + (i32.shr_u + (get_local $8) + (i32.const 31) ) + (i32.const 2) ) ) ) @@ -9397,52 +9392,51 @@ ) ) ) - (set_local $4 - (i32.shl - (get_local $8) - (i32.xor - (tee_local $6 - (i32.eqz - (get_local $9) - ) + ) + (set_local $4 + (i32.shl + (get_local $8) + (i32.xor + (tee_local $6 + (i32.eqz + (get_local $9) ) - (i32.const 1) ) + (i32.const 1) ) ) - (if - (get_local $6) - (block - (set_local $4 - (get_local $0) - ) - (set_local $0 - (get_local $1) - ) - (br $__rjti$2) + ) + (if + (get_local $6) + (block + (set_local $4 + (get_local $0) ) - (block - (set_local $6 - (get_local $0) - ) - (set_local $8 - (get_local $4) - ) - (set_local $0 - (get_local $9) - ) - (br $while-in14) + (set_local $0 + (get_local $1) + ) + ) + (block + (set_local $6 + (get_local $0) + ) + (set_local $8 + (get_local $4) + ) + (set_local $0 + (get_local $9) ) + (br $while-in14) ) ) ) - (block - (set_local $4 - (i32.const 0) - ) - (set_local $0 - (i32.const 0) - ) + ) + (block + (set_local $4 + (i32.const 0) + ) + (set_local $0 + (i32.const 0) ) ) ) @@ -10369,55 +10363,53 @@ ) (block $__rjto$1 (block $__rjti$1 - (block $__rjti$0 - (loop $while-in28 - (br_if $__rjti$1 - (i32.eq - (i32.and - (i32.load offset=4 - (get_local $0) - ) - (i32.const -8) + (loop $while-in28 + (br_if $__rjti$1 + (i32.eq + (i32.and + (i32.load offset=4 + (get_local $0) ) - (get_local $3) + (i32.const -8) ) + (get_local $3) ) - (set_local $2 - (i32.shl - (get_local $7) - (i32.const 1) - ) + ) + (set_local $2 + (i32.shl + (get_local $7) + (i32.const 1) ) - (br_if $__rjti$0 - (i32.eqz - (tee_local $1 - (i32.load - (tee_local $7 - (i32.add - (i32.add - (get_local $0) - (i32.const 16) - ) - (i32.shl - (i32.shr_u - (get_local $7) - (i32.const 31) - ) - (i32.const 2) - ) + ) + (if + (tee_local $1 + (i32.load + (tee_local $7 + (i32.add + (i32.add + (get_local $0) + (i32.const 16) + ) + (i32.shl + (i32.shr_u + (get_local $7) + (i32.const 31) ) + (i32.const 2) ) ) ) ) ) - (set_local $7 - (get_local $2) - ) - (set_local $0 - (get_local $1) + (block + (set_local $7 + (get_local $2) + ) + (set_local $0 + (get_local $1) + ) + (br $while-in28) ) - (br $while-in28) ) ) (if @@ -12409,55 +12401,53 @@ ) (block $__rjto$7 (block $__rjti$7 - (block $__rjti$6 - (loop $while-in68 - (br_if $__rjti$7 - (i32.eq - (i32.and - (i32.load offset=4 - (get_local $0) - ) - (i32.const -8) + (loop $while-in68 + (br_if $__rjti$7 + (i32.eq + (i32.and + (i32.load offset=4 + (get_local $0) ) - (get_local $7) + (i32.const -8) ) + (get_local $7) ) - (set_local $3 - (i32.shl - (get_local $2) - (i32.const 1) - ) + ) + (set_local $3 + (i32.shl + (get_local $2) + (i32.const 1) ) - (br_if $__rjti$6 - (i32.eqz - (tee_local $1 - (i32.load - (tee_local $2 - (i32.add - (i32.add - (get_local $0) - (i32.const 16) - ) - (i32.shl - (i32.shr_u - (get_local $2) - (i32.const 31) - ) - (i32.const 2) - ) + ) + (if + (tee_local $1 + (i32.load + (tee_local $2 + (i32.add + (i32.add + (get_local $0) + (i32.const 16) + ) + (i32.shl + (i32.shr_u + (get_local $2) + (i32.const 31) ) + (i32.const 2) ) ) ) ) ) - (set_local $2 - (get_local $3) - ) - (set_local $0 - (get_local $1) + (block + (set_local $2 + (get_local $3) + ) + (set_local $0 + (get_local $1) + ) + (br $while-in68) ) - (br $while-in68) ) ) (if @@ -13085,55 +13075,53 @@ ) (block $__rjto$9 (block $__rjti$9 - (block $__rjti$8 - (loop $while-in74 - (br_if $__rjti$9 - (i32.eq - (i32.and - (i32.load offset=4 - (get_local $1) - ) - (i32.const -8) + (loop $while-in74 + (br_if $__rjti$9 + (i32.eq + (i32.and + (i32.load offset=4 + (get_local $1) ) - (get_local $5) + (i32.const -8) ) + (get_local $5) ) - (set_local $2 - (i32.shl - (get_local $4) - (i32.const 1) - ) + ) + (set_local $2 + (i32.shl + (get_local $4) + (i32.const 1) ) - (br_if $__rjti$8 - (i32.eqz - (tee_local $3 - (i32.load - (tee_local $4 - (i32.add - (i32.add - (get_local $1) - (i32.const 16) - ) - (i32.shl - (i32.shr_u - (get_local $4) - (i32.const 31) - ) - (i32.const 2) - ) + ) + (if + (tee_local $3 + (i32.load + (tee_local $4 + (i32.add + (i32.add + (get_local $1) + (i32.const 16) + ) + (i32.shl + (i32.shr_u + (get_local $4) + (i32.const 31) ) + (i32.const 2) ) ) ) ) ) - (set_local $4 - (get_local $2) - ) - (set_local $1 - (get_local $3) + (block + (set_local $4 + (get_local $2) + ) + (set_local $1 + (get_local $3) + ) + (br $while-in74) ) - (br $while-in74) ) ) (if @@ -15013,55 +15001,53 @@ ) (block $__rjto$1 (block $__rjti$1 - (block $__rjti$0 - (loop $while-in15 - (br_if $__rjti$1 - (i32.eq - (i32.and - (i32.load offset=4 - (get_local $0) - ) - (i32.const -8) + (loop $while-in15 + (br_if $__rjti$1 + (i32.eq + (i32.and + (i32.load offset=4 + (get_local $0) ) - (get_local $3) + (i32.const -8) ) + (get_local $3) ) - (set_local $4 - (i32.shl - (get_local $5) - (i32.const 1) - ) + ) + (set_local $4 + (i32.shl + (get_local $5) + (i32.const 1) ) - (br_if $__rjti$0 - (i32.eqz - (tee_local $1 - (i32.load - (tee_local $5 - (i32.add - (i32.add - (get_local $0) - (i32.const 16) - ) - (i32.shl - (i32.shr_u - (get_local $5) - (i32.const 31) - ) - (i32.const 2) - ) + ) + (if + (tee_local $1 + (i32.load + (tee_local $5 + (i32.add + (i32.add + (get_local $0) + (i32.const 16) + ) + (i32.shl + (i32.shr_u + (get_local $5) + (i32.const 31) ) + (i32.const 2) ) ) ) ) ) - (set_local $5 - (get_local $4) - ) - (set_local $0 - (get_local $1) + (block + (set_local $5 + (get_local $4) + ) + (set_local $0 + (get_local $1) + ) + (br $while-in15) ) - (br $while-in15) ) ) (if diff --git a/test/emcc_hello_world.fromasm.imprecise b/test/emcc_hello_world.fromasm.imprecise index 3aa9ed739..0e4228725 100644 --- a/test/emcc_hello_world.fromasm.imprecise +++ b/test/emcc_hello_world.fromasm.imprecise @@ -1828,94 +1828,91 @@ ) (block $label$break$L8 (block $__rjti$2 - (block $__rjti$1 - (if - (i32.and - (tee_local $4 - (i32.ne - (get_local $2) - (i32.const 0) - ) - ) + (if + (i32.and + (tee_local $4 (i32.ne - (i32.and - (get_local $0) - (i32.const 3) - ) + (get_local $2) (i32.const 0) ) ) - (block - (set_local $4 - (i32.and - (get_local $1) - (i32.const 255) - ) - ) - (set_local $3 - (get_local $2) - ) - (set_local $2 + (i32.ne + (i32.and (get_local $0) + (i32.const 3) ) - (loop $while-in - (if - (i32.eq - (i32.load8_u - (get_local $2) - ) - (i32.and - (get_local $4) - (i32.const 255) - ) + (i32.const 0) + ) + ) + (block + (set_local $4 + (i32.and + (get_local $1) + (i32.const 255) + ) + ) + (set_local $3 + (get_local $2) + ) + (set_local $2 + (get_local $0) + ) + (loop $while-in + (if + (i32.eq + (i32.load8_u + (get_local $2) ) - (block - (set_local $0 - (get_local $3) - ) - (br $__rjti$2) + (i32.and + (get_local $4) + (i32.const 255) ) ) - (br_if $while-in - (i32.and - (tee_local $0 - (i32.ne - (tee_local $3 - (i32.add - (get_local $3) - (i32.const -1) - ) + (block + (set_local $0 + (get_local $3) + ) + (br $__rjti$2) + ) + ) + (br_if $while-in + (i32.and + (tee_local $0 + (i32.ne + (tee_local $3 + (i32.add + (get_local $3) + (i32.const -1) ) - (i32.const 0) ) + (i32.const 0) ) - (i32.ne - (i32.and - (tee_local $2 - (i32.add - (get_local $2) - (i32.const 1) - ) + ) + (i32.ne + (i32.and + (tee_local $2 + (i32.add + (get_local $2) + (i32.const 1) ) - (i32.const 3) ) - (i32.const 0) + (i32.const 3) ) + (i32.const 0) ) ) - (br $__rjti$1) ) ) - (block - (set_local $3 - (get_local $2) - ) - (set_local $2 - (get_local $0) - ) - (set_local $0 - (get_local $4) - ) + ) + (block + (set_local $3 + (get_local $2) + ) + (set_local $2 + (get_local $0) + ) + (set_local $0 + (get_local $4) ) ) ) @@ -2744,69 +2741,71 @@ (block (set_local $10 (block $__rjto$0 i32 - (block $__rjti$0 - (br_if $__rjti$0 - (i32.ge_u - (tee_local $11 - (i32.add - (i32.load8_s - (tee_local $6 - (i32.add - (get_local $10) - (i32.const 1) + (if + (i32.eqz + (i32.or + (i32.ge_u + (tee_local $11 + (i32.add + (i32.load8_s + (tee_local $6 + (i32.add + (get_local $10) + (i32.const 1) + ) ) ) + (i32.const -48) ) - (i32.const -48) ) + (i32.const 10) ) - (i32.const 10) - ) - ) - (br_if $__rjti$0 - (i32.ne - (i32.load8_s offset=2 - (get_local $10) + (i32.ne + (i32.load8_s offset=2 + (get_local $10) + ) + (i32.const 36) ) - (i32.const 36) ) ) - (i32.store - (i32.add - (get_local $4) - (i32.shl - (get_local $11) - (i32.const 2) + (block + (i32.store + (i32.add + (get_local $4) + (i32.shl + (get_local $11) + (i32.const 2) + ) ) + (i32.const 10) ) - (i32.const 10) - ) - (set_local $6 - (i32.add - (get_local $3) - (i32.shl - (i32.add - (i32.load8_s - (get_local $6) + (set_local $6 + (i32.add + (get_local $3) + (i32.shl + (i32.add + (i32.load8_s + (get_local $6) + ) + (i32.const -48) ) - (i32.const -48) + (i32.const 3) ) - (i32.const 3) ) ) - ) - (set_local $8 - (i32.const 1) - ) - (set_local $14 - (i32.load - (get_local $6) + (set_local $8 + (i32.const 1) ) - ) - (br $__rjto$0 - (i32.add - (get_local $10) - (i32.const 3) + (set_local $14 + (i32.load + (get_local $6) + ) + ) + (br $__rjto$0 + (i32.add + (get_local $10) + (i32.const 3) + ) ) ) ) @@ -9197,112 +9196,110 @@ ) (block $__rjto$3 (block $__rjti$3 - (block $__rjti$2 - (if - (tee_local $0 - (i32.load offset=480 - (i32.shl - (get_local $14) - (i32.const 2) - ) + (if + (tee_local $0 + (i32.load offset=480 + (i32.shl + (get_local $14) + (i32.const 2) ) ) - (block - (set_local $6 - (i32.const 0) - ) - (set_local $8 - (i32.shl - (get_local $2) - (select - (i32.const 0) - (i32.sub - (i32.const 25) - (i32.shr_u - (get_local $14) - (i32.const 1) - ) - ) - (i32.eq + ) + (block + (set_local $6 + (i32.const 0) + ) + (set_local $8 + (i32.shl + (get_local $2) + (select + (i32.const 0) + (i32.sub + (i32.const 25) + (i32.shr_u (get_local $14) - (i32.const 31) + (i32.const 1) ) ) + (i32.eq + (get_local $14) + (i32.const 31) + ) ) ) - (set_local $1 - (i32.const 0) - ) - (loop $while-in14 - (if - (i32.lt_u - (tee_local $4 - (i32.sub - (tee_local $9 - (i32.and - (i32.load offset=4 - (get_local $0) - ) - (i32.const -8) + ) + (set_local $1 + (i32.const 0) + ) + (loop $while-in14 + (if + (i32.lt_u + (tee_local $4 + (i32.sub + (tee_local $9 + (i32.and + (i32.load offset=4 + (get_local $0) ) + (i32.const -8) ) - (get_local $2) ) + (get_local $2) ) - (get_local $3) ) - (if - (i32.eq - (get_local $9) - (get_local $2) + (get_local $3) + ) + (if + (i32.eq + (get_local $9) + (get_local $2) + ) + (block + (set_local $1 + (get_local $4) ) - (block - (set_local $1 - (get_local $4) - ) - (set_local $3 - (get_local $0) - ) - (br $__rjti$3) + (set_local $3 + (get_local $0) ) - (block - (set_local $3 - (get_local $4) - ) - (set_local $1 - (get_local $0) - ) + (br $__rjti$3) + ) + (block + (set_local $3 + (get_local $4) + ) + (set_local $1 + (get_local $0) ) ) ) - (set_local $0 - (select - (get_local $6) - (tee_local $4 - (i32.load offset=20 - (get_local $0) - ) + ) + (set_local $0 + (select + (get_local $6) + (tee_local $4 + (i32.load offset=20 + (get_local $0) ) - (i32.or - (i32.eqz - (get_local $4) - ) - (i32.eq - (get_local $4) - (tee_local $9 - (i32.load + ) + (i32.or + (i32.eqz + (get_local $4) + ) + (i32.eq + (get_local $4) + (tee_local $9 + (i32.load + (i32.add (i32.add - (i32.add - (get_local $0) - (i32.const 16) - ) - (i32.shl - (i32.shr_u - (get_local $8) - (i32.const 31) - ) - (i32.const 2) + (get_local $0) + (i32.const 16) + ) + (i32.shl + (i32.shr_u + (get_local $8) + (i32.const 31) ) + (i32.const 2) ) ) ) @@ -9310,52 +9307,51 @@ ) ) ) - (set_local $4 - (i32.shl - (get_local $8) - (i32.xor - (tee_local $6 - (i32.eqz - (get_local $9) - ) + ) + (set_local $4 + (i32.shl + (get_local $8) + (i32.xor + (tee_local $6 + (i32.eqz + (get_local $9) ) - (i32.const 1) ) + (i32.const 1) ) ) - (if - (get_local $6) - (block - (set_local $4 - (get_local $0) - ) - (set_local $0 - (get_local $1) - ) - (br $__rjti$2) + ) + (if + (get_local $6) + (block + (set_local $4 + (get_local $0) ) - (block - (set_local $6 - (get_local $0) - ) - (set_local $8 - (get_local $4) - ) - (set_local $0 - (get_local $9) - ) - (br $while-in14) + (set_local $0 + (get_local $1) ) ) + (block + (set_local $6 + (get_local $0) + ) + (set_local $8 + (get_local $4) + ) + (set_local $0 + (get_local $9) + ) + (br $while-in14) + ) ) ) - (block - (set_local $4 - (i32.const 0) - ) - (set_local $0 - (i32.const 0) - ) + ) + (block + (set_local $4 + (i32.const 0) + ) + (set_local $0 + (i32.const 0) ) ) ) @@ -10282,55 +10278,53 @@ ) (block $__rjto$1 (block $__rjti$1 - (block $__rjti$0 - (loop $while-in28 - (br_if $__rjti$1 - (i32.eq - (i32.and - (i32.load offset=4 - (get_local $0) - ) - (i32.const -8) + (loop $while-in28 + (br_if $__rjti$1 + (i32.eq + (i32.and + (i32.load offset=4 + (get_local $0) ) - (get_local $3) + (i32.const -8) ) + (get_local $3) ) - (set_local $2 - (i32.shl - (get_local $7) - (i32.const 1) - ) + ) + (set_local $2 + (i32.shl + (get_local $7) + (i32.const 1) ) - (br_if $__rjti$0 - (i32.eqz - (tee_local $1 - (i32.load - (tee_local $7 - (i32.add - (i32.add - (get_local $0) - (i32.const 16) - ) - (i32.shl - (i32.shr_u - (get_local $7) - (i32.const 31) - ) - (i32.const 2) - ) + ) + (if + (tee_local $1 + (i32.load + (tee_local $7 + (i32.add + (i32.add + (get_local $0) + (i32.const 16) + ) + (i32.shl + (i32.shr_u + (get_local $7) + (i32.const 31) ) + (i32.const 2) ) ) ) ) ) - (set_local $7 - (get_local $2) - ) - (set_local $0 - (get_local $1) + (block + (set_local $7 + (get_local $2) + ) + (set_local $0 + (get_local $1) + ) + (br $while-in28) ) - (br $while-in28) ) ) (if @@ -12322,55 +12316,53 @@ ) (block $__rjto$7 (block $__rjti$7 - (block $__rjti$6 - (loop $while-in68 - (br_if $__rjti$7 - (i32.eq - (i32.and - (i32.load offset=4 - (get_local $0) - ) - (i32.const -8) + (loop $while-in68 + (br_if $__rjti$7 + (i32.eq + (i32.and + (i32.load offset=4 + (get_local $0) ) - (get_local $7) + (i32.const -8) ) + (get_local $7) ) - (set_local $3 - (i32.shl - (get_local $2) - (i32.const 1) - ) + ) + (set_local $3 + (i32.shl + (get_local $2) + (i32.const 1) ) - (br_if $__rjti$6 - (i32.eqz - (tee_local $1 - (i32.load - (tee_local $2 - (i32.add - (i32.add - (get_local $0) - (i32.const 16) - ) - (i32.shl - (i32.shr_u - (get_local $2) - (i32.const 31) - ) - (i32.const 2) - ) + ) + (if + (tee_local $1 + (i32.load + (tee_local $2 + (i32.add + (i32.add + (get_local $0) + (i32.const 16) + ) + (i32.shl + (i32.shr_u + (get_local $2) + (i32.const 31) ) + (i32.const 2) ) ) ) ) ) - (set_local $2 - (get_local $3) - ) - (set_local $0 - (get_local $1) + (block + (set_local $2 + (get_local $3) + ) + (set_local $0 + (get_local $1) + ) + (br $while-in68) ) - (br $while-in68) ) ) (if @@ -12998,55 +12990,53 @@ ) (block $__rjto$9 (block $__rjti$9 - (block $__rjti$8 - (loop $while-in74 - (br_if $__rjti$9 - (i32.eq - (i32.and - (i32.load offset=4 - (get_local $1) - ) - (i32.const -8) + (loop $while-in74 + (br_if $__rjti$9 + (i32.eq + (i32.and + (i32.load offset=4 + (get_local $1) ) - (get_local $5) + (i32.const -8) ) + (get_local $5) ) - (set_local $2 - (i32.shl - (get_local $4) - (i32.const 1) - ) + ) + (set_local $2 + (i32.shl + (get_local $4) + (i32.const 1) ) - (br_if $__rjti$8 - (i32.eqz - (tee_local $3 - (i32.load - (tee_local $4 - (i32.add - (i32.add - (get_local $1) - (i32.const 16) - ) - (i32.shl - (i32.shr_u - (get_local $4) - (i32.const 31) - ) - (i32.const 2) - ) + ) + (if + (tee_local $3 + (i32.load + (tee_local $4 + (i32.add + (i32.add + (get_local $1) + (i32.const 16) + ) + (i32.shl + (i32.shr_u + (get_local $4) + (i32.const 31) ) + (i32.const 2) ) ) ) ) ) - (set_local $4 - (get_local $2) - ) - (set_local $1 - (get_local $3) + (block + (set_local $4 + (get_local $2) + ) + (set_local $1 + (get_local $3) + ) + (br $while-in74) ) - (br $while-in74) ) ) (if @@ -14925,55 +14915,53 @@ ) (block $__rjto$1 (block $__rjti$1 - (block $__rjti$0 - (loop $while-in15 - (br_if $__rjti$1 - (i32.eq - (i32.and - (i32.load offset=4 - (get_local $0) - ) - (i32.const -8) + (loop $while-in15 + (br_if $__rjti$1 + (i32.eq + (i32.and + (i32.load offset=4 + (get_local $0) ) - (get_local $3) + (i32.const -8) ) + (get_local $3) ) - (set_local $4 - (i32.shl - (get_local $5) - (i32.const 1) - ) + ) + (set_local $4 + (i32.shl + (get_local $5) + (i32.const 1) ) - (br_if $__rjti$0 - (i32.eqz - (tee_local $1 - (i32.load - (tee_local $5 - (i32.add - (i32.add - (get_local $0) - (i32.const 16) - ) - (i32.shl - (i32.shr_u - (get_local $5) - (i32.const 31) - ) - (i32.const 2) - ) + ) + (if + (tee_local $1 + (i32.load + (tee_local $5 + (i32.add + (i32.add + (get_local $0) + (i32.const 16) + ) + (i32.shl + (i32.shr_u + (get_local $5) + (i32.const 31) ) + (i32.const 2) ) ) ) ) ) - (set_local $5 - (get_local $4) - ) - (set_local $0 - (get_local $1) + (block + (set_local $5 + (get_local $4) + ) + (set_local $0 + (get_local $1) + ) + (br $while-in15) ) - (br $while-in15) ) ) (if diff --git a/test/example/relooper-fuzz.txt b/test/example/relooper-fuzz.txt index 416f54987..438a4bca1 100644 --- a/test/example/relooper-fuzz.txt +++ b/test/example/relooper-fuzz.txt @@ -519,17 +519,19 @@ ) (br $shape$3$continue) ) + (block + (call $print + (i32.const 2) + ) + (drop + (call $check) + ) + (set_local $0 + (i32.const 6) + ) + (br $shape$3$continue) + ) ) - (call $print - (i32.const 2) - ) - (drop - (call $check) - ) - (set_local $0 - (i32.const 6) - ) - (br $shape$3$continue) ) ) ) diff --git a/test/passes/O.bin.txt b/test/passes/O.bin.txt index 395c04369..7b80e0211 100644 --- a/test/passes/O.bin.txt +++ b/test/passes/O.bin.txt @@ -57,27 +57,27 @@ (set_local $1 (i64.const 1) ) - (block $label$1 - (loop $label$2 - (br_if $label$1 - (i64.eq - (get_local $0) - (i64.const 0) - ) + (loop $label$2 + (if + (i64.ne + (get_local $0) + (i64.const 0) ) - (set_local $1 - (i64.mul - (get_local $0) - (get_local $1) + (block + (set_local $1 + (i64.mul + (get_local $0) + (get_local $1) + ) ) - ) - (set_local $0 - (i64.sub - (get_local $0) - (i64.const 1) + (set_local $0 + (i64.sub + (get_local $0) + (i64.const 1) + ) ) + (br $label$2) ) - (br $label$2) ) ) (get_local $1) diff --git a/test/passes/remove-unused-brs.txt b/test/passes/remove-unused-brs.txt index e1db8561c..ce5aee59a 100644 --- a/test/passes/remove-unused-brs.txt +++ b/test/passes/remove-unused-brs.txt @@ -939,21 +939,40 @@ ) (func $loop-if (type $2) (result i32) (block $outer i32 - (loop $typed - (br_if $typed - (i32.eqz - (i32.const 2) - ) - ) - (block $block - (drop - (call $loop-if) - ) - (br $outer + (loop $typed i32 + (if i32 + (i32.const 2) + (block $block i32 + (drop + (call $loop-if) + ) (i32.const 0) ) + (br $typed) + ) + ) + ) + ) + (func $block-break (type $0) (param $0 i32) + (block $block$7$break + (block $shape$6$continue + (call $block-break + (i32.const 1) ) ) ) ) + (func $loop-break (type $0) (param $0 i32) + (block $block$7$break + (loop $shape$6$continue + (call $loop-break + (i32.const 1) + ) + (br_if $shape$6$continue + (get_local $0) + ) + (nop) + ) + ) + ) ) diff --git a/test/passes/remove-unused-brs.wast b/test/passes/remove-unused-brs.wast index 40ca5f520..c37a7a56a 100644 --- a/test/passes/remove-unused-brs.wast +++ b/test/passes/remove-unused-brs.wast @@ -847,5 +847,24 @@ ) ) ) + (func $block-break (param $0 i32) + (block $block$7$break + (block $shape$6$continue + (call $block-break (i32.const 1)) + (br $block$7$break) + ) + ) + ) + (func $loop-break (param $0 i32) + (block $block$7$break + (loop $shape$6$continue + (call $loop-break (i32.const 1)) + (br_if $shape$6$continue + (get_local $0) + ) + (br $block$7$break) + ) + ) + ) ) diff --git a/test/unit.fromasm b/test/unit.fromasm index 2b077edee..14654ff7a 100644 --- a/test/unit.fromasm +++ b/test/unit.fromasm @@ -198,15 +198,11 @@ ) ) (block $switch-case9 - (block $switch-case6 - (block $switch-case5 - (block $switch-case4 - (br_table $switch-case9 $switch-case9 $switch-case9 $switch-case6 $switch-case9 $switch-case9 $switch-case9 $switch-case9 $switch-case5 $switch-case9 $switch-case4 $switch-case9 - (i32.sub - (get_local $0) - (i32.const 2) - ) - ) + (block $switch-case4 + (br_table $switch-case9 $switch-case9 $switch-case9 $switch-case4 $switch-case9 $switch-case9 $switch-case9 $switch-case9 $switch-case4 $switch-case9 $switch-case4 $switch-case9 + (i32.sub + (get_local $0) + (i32.const 2) ) ) ) @@ -833,22 +829,19 @@ (call $h (i32.const -1) ) - (block $__rjti$1 - (loop $while-in - (br_if $while-in - (i32.eqz - (tee_local $0 - (i32.add - (get_local $0) - (i32.const 1) - ) + (loop $while-in + (br_if $while-in + (i32.eqz + (tee_local $0 + (i32.add + (get_local $0) + (i32.const 1) ) ) ) - (call $h - (i32.const 2) - ) - (br $__rjti$1) + ) + (call $h + (i32.const 2) ) ) (call $h diff --git a/test/unit.fromasm.clamp b/test/unit.fromasm.clamp index 34d95925d..d59c8d0a3 100644 --- a/test/unit.fromasm.clamp +++ b/test/unit.fromasm.clamp @@ -222,15 +222,11 @@ ) ) (block $switch-case9 - (block $switch-case6 - (block $switch-case5 - (block $switch-case4 - (br_table $switch-case9 $switch-case9 $switch-case9 $switch-case6 $switch-case9 $switch-case9 $switch-case9 $switch-case9 $switch-case5 $switch-case9 $switch-case4 $switch-case9 - (i32.sub - (get_local $0) - (i32.const 2) - ) - ) + (block $switch-case4 + (br_table $switch-case9 $switch-case9 $switch-case9 $switch-case4 $switch-case9 $switch-case9 $switch-case9 $switch-case9 $switch-case4 $switch-case9 $switch-case4 $switch-case9 + (i32.sub + (get_local $0) + (i32.const 2) ) ) ) @@ -857,22 +853,19 @@ (call $h (i32.const -1) ) - (block $__rjti$1 - (loop $while-in - (br_if $while-in - (i32.eqz - (tee_local $0 - (i32.add - (get_local $0) - (i32.const 1) - ) + (loop $while-in + (br_if $while-in + (i32.eqz + (tee_local $0 + (i32.add + (get_local $0) + (i32.const 1) ) ) ) - (call $h - (i32.const 2) - ) - (br $__rjti$1) + ) + (call $h + (i32.const 2) ) ) (call $h diff --git a/test/unit.fromasm.imprecise b/test/unit.fromasm.imprecise index b0f46e7ad..bf01a4681 100644 --- a/test/unit.fromasm.imprecise +++ b/test/unit.fromasm.imprecise @@ -179,15 +179,11 @@ ) ) (block $switch-case9 - (block $switch-case6 - (block $switch-case5 - (block $switch-case4 - (br_table $switch-case9 $switch-case9 $switch-case9 $switch-case6 $switch-case9 $switch-case9 $switch-case9 $switch-case9 $switch-case5 $switch-case9 $switch-case4 $switch-case9 - (i32.sub - (get_local $0) - (i32.const 2) - ) - ) + (block $switch-case4 + (br_table $switch-case9 $switch-case9 $switch-case9 $switch-case4 $switch-case9 $switch-case9 $switch-case9 $switch-case9 $switch-case4 $switch-case9 $switch-case4 $switch-case9 + (i32.sub + (get_local $0) + (i32.const 2) ) ) ) @@ -801,22 +797,19 @@ (call $h (i32.const -1) ) - (block $__rjti$1 - (loop $while-in - (br_if $while-in - (i32.eqz - (tee_local $0 - (i32.add - (get_local $0) - (i32.const 1) - ) + (loop $while-in + (br_if $while-in + (i32.eqz + (tee_local $0 + (i32.add + (get_local $0) + (i32.const 1) ) ) ) - (call $h - (i32.const 2) - ) - (br $__rjti$1) + ) + (call $h + (i32.const 2) ) ) (call $h diff --git a/test/wasm-only.fromasm b/test/wasm-only.fromasm index 4a16b61fb..b8d876711 100644 --- a/test/wasm-only.fromasm +++ b/test/wasm-only.fromasm @@ -363,7 +363,6 @@ (get_local $1) ) (block - (nop) (br_if $__rjto$0 (get_local $2) ) diff --git a/test/wasm-only.fromasm.clamp b/test/wasm-only.fromasm.clamp index 4a16b61fb..b8d876711 100644 --- a/test/wasm-only.fromasm.clamp +++ b/test/wasm-only.fromasm.clamp @@ -363,7 +363,6 @@ (get_local $1) ) (block - (nop) (br_if $__rjto$0 (get_local $2) ) diff --git a/test/wasm-only.fromasm.imprecise b/test/wasm-only.fromasm.imprecise index 168d8849e..ae68d6a66 100644 --- a/test/wasm-only.fromasm.imprecise +++ b/test/wasm-only.fromasm.imprecise @@ -278,7 +278,6 @@ (get_local $1) ) (block - (nop) (br_if $__rjto$0 (get_local $2) ) |