diff options
author | Alon Zakai (kripken) <alonzakai@gmail.com> | 2017-05-10 14:55:34 -0700 |
---|---|---|
committer | Alon Zakai (kripken) <alonzakai@gmail.com> | 2017-05-10 14:55:34 -0700 |
commit | b3c97a9d6e9c0858c7a021c6437a4f38ceb7a156 (patch) | |
tree | 839be4a2210611c008527b54ad741db52aa0d456 | |
parent | a42f2247e0f4ddd7c4560a9d466f65ee88753bd7 (diff) | |
download | binaryen-b3c97a9d6e9c0858c7a021c6437a4f38ceb7a156.tar.gz binaryen-b3c97a9d6e9c0858c7a021c6437a4f38ceb7a156.tar.bz2 binaryen-b3c97a9d6e9c0858c7a021c6437a4f38ceb7a156.zip |
merge blocks before and after remove-unused-brs
-rw-r--r-- | src/passes/pass.cpp | 3 | ||||
-rw-r--r-- | test/emcc_hello_world.fromasm.imprecise | 98 | ||||
-rw-r--r-- | test/example/relooper-fuzz.txt | 22 | ||||
-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 |
6 files changed, 64 insertions, 62 deletions
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.imprecise b/test/emcc_hello_world.fromasm.imprecise index 9f06aecd2..0e4228725 100644 --- a/test/emcc_hello_world.fromasm.imprecise +++ b/test/emcc_hello_world.fromasm.imprecise @@ -2741,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) + ) ) ) ) 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/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) ) |