diff options
author | Alon Zakai <azakai@google.com> | 2021-04-20 08:21:42 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-20 08:21:42 -0700 |
commit | 02ae2661c9cb748d5479017a3db7bbd222e2daf5 (patch) | |
tree | 3446624c393b21ab349c654189fa2aa49d84cb87 /test/passes/asyncify_optimize-level=1.txt | |
parent | f180f6c11d2ddf9acc806333c0a452bb57f8acf9 (diff) | |
download | binaryen-02ae2661c9cb748d5479017a3db7bbd222e2daf5.tar.gz binaryen-02ae2661c9cb748d5479017a3db7bbd222e2daf5.tar.bz2 binaryen-02ae2661c9cb748d5479017a3db7bbd222e2daf5.zip |
Optimize if/select with one arm an EqZ and another a 0 or a 1 (#3822)
(select
(i32.eqz (X))
(i32.const 0|1)
(Y)
)
=>
(i32.eqz
(select
(X)
(i32.const 1|0)
(Y)
)
)
This is beneficial as the eqz may be folded into something on the outside. I
see this pattern in real-world code, both a GC benchmark (which is why I
noticed it) and it shrinks code size by tiny amounts on the emscripten
benchmark suite as well.
Diffstat (limited to 'test/passes/asyncify_optimize-level=1.txt')
-rw-r--r-- | test/passes/asyncify_optimize-level=1.txt | 112 |
1 files changed, 56 insertions, 56 deletions
diff --git a/test/passes/asyncify_optimize-level=1.txt b/test/passes/asyncify_optimize-level=1.txt index 2c8835edf..9909918f2 100644 --- a/test/passes/asyncify_optimize-level=1.txt +++ b/test/passes/asyncify_optimize-level=1.txt @@ -19,8 +19,8 @@ (local.set $0 (block $__asyncify_unwind (result i32) (if - (select - (i32.eqz + (i32.eqz + (select (if (result i32) (i32.eq (global.get $__asyncify_state) @@ -44,9 +44,9 @@ ) (local.get $0) ) + (i32.const 0) + (global.get $__asyncify_state) ) - (i32.const 1) - (global.get $__asyncify_state) ) (block (call $import) @@ -110,8 +110,8 @@ (local.set $1 (block $__asyncify_unwind (result i32) (if - (select - (i32.eqz + (i32.eqz + (select (if (result i32) (i32.eq (global.get $__asyncify_state) @@ -135,9 +135,9 @@ ) (local.get $1) ) + (i32.const 0) + (global.get $__asyncify_state) ) - (i32.const 1) - (global.get $__asyncify_state) ) (block (local.set $1 @@ -205,8 +205,8 @@ (local.set $0 (block $__asyncify_unwind (result i32) (if - (select - (i32.eqz + (i32.eqz + (select (if (result i32) (i32.eq (global.get $__asyncify_state) @@ -230,9 +230,9 @@ ) (local.get $0) ) + (i32.const 0) + (global.get $__asyncify_state) ) - (i32.const 1) - (global.get $__asyncify_state) ) (block (drop @@ -343,12 +343,12 @@ ) ) (if - (select - (i32.eqz + (i32.eqz + (select (local.get $2) + (i32.const 0) + (global.get $__asyncify_state) ) - (i32.const 1) - (global.get $__asyncify_state) ) (block (call $import) @@ -443,12 +443,12 @@ ) ) (if - (select - (i32.eqz + (i32.eqz + (select (local.get $1) + (i32.const 0) + (global.get $__asyncify_state) ) - (i32.const 1) - (global.get $__asyncify_state) ) (block (call $import) @@ -551,12 +551,12 @@ ) ) (if - (select - (i32.eqz + (i32.eqz + (select (local.get $2) + (i32.const 0) + (global.get $__asyncify_state) ) - (i32.const 1) - (global.get $__asyncify_state) ) (block (call $import3 @@ -706,12 +706,12 @@ ) ) (if - (select - (i32.eqz + (i32.eqz + (select (local.get $1) + (i32.const 0) + (global.get $__asyncify_state) ) - (i32.const 1) - (global.get $__asyncify_state) ) (block (call $import3 @@ -825,12 +825,12 @@ ) ) (if - (select - (i32.eqz + (i32.eqz + (select (local.get $2) + (i32.const 0) + (global.get $__asyncify_state) ) - (i32.const 1) - (global.get $__asyncify_state) ) (block (call $import3 @@ -964,12 +964,12 @@ ) (loop $l (if - (select - (i32.eqz + (i32.eqz + (select (local.get $1) + (i32.const 0) + (global.get $__asyncify_state) ) - (i32.const 1) - (global.get $__asyncify_state) ) (block (call $import3 @@ -1090,12 +1090,12 @@ ) (loop $l (if - (select - (i32.eqz + (i32.eqz + (select (local.get $2) + (i32.const 0) + (global.get $__asyncify_state) ) - (i32.const 1) - (global.get $__asyncify_state) ) (block (local.set $1 @@ -1116,12 +1116,12 @@ ) ) (br_if $l - (select - (i32.eqz + (i32.eqz + (select (global.get $__asyncify_state) + (i32.const 1) + (local.get $0) ) - (i32.const 0) - (local.get $0) ) ) ) @@ -1194,12 +1194,12 @@ (call $boring) ) (if - (select - (i32.eqz + (i32.eqz + (select (local.get $0) + (i32.const 0) + (global.get $__asyncify_state) ) - (i32.const 1) - (global.get $__asyncify_state) ) (block (call $import) @@ -1299,12 +1299,12 @@ (call $boring-deep) ) (if - (select - (i32.eqz + (i32.eqz + (select (local.get $0) + (i32.const 0) + (global.get $__asyncify_state) ) - (i32.const 1) - (global.get $__asyncify_state) ) (block (call $import-deep) @@ -1374,8 +1374,8 @@ (local.set $0 (block $__asyncify_unwind (result i32) (if - (select - (i32.eqz + (i32.eqz + (select (if (result i32) (i32.eq (global.get $__asyncify_state) @@ -1399,9 +1399,9 @@ ) (local.get $0) ) + (i32.const 0) + (global.get $__asyncify_state) ) - (i32.const 1) - (global.get $__asyncify_state) ) (block (call $import) |