diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/passes/coalesce-locals.txt | 45 | ||||
-rw-r--r-- | test/passes/remove-unused-brs.txt | 156 | ||||
-rw-r--r-- | test/passes/remove-unused-brs.wast | 153 |
3 files changed, 332 insertions, 22 deletions
diff --git a/test/passes/coalesce-locals.txt b/test/passes/coalesce-locals.txt index 4f856d0dc..a46c645a5 100644 --- a/test/passes/coalesce-locals.txt +++ b/test/passes/coalesce-locals.txt @@ -1010,11 +1010,10 @@ (local $0 i32) (local $1 i32) (loop $top - (if - (i32.eqz + (set_local $0 + (if (result i32) (i32.const 1) - ) - (set_local $0 + (get_local $0) (get_local $1) ) ) @@ -1031,10 +1030,11 @@ (local $0 i32) (local $1 i32) (loop $top - (if - (i32.const 1) - (set_local $1 + (set_local $1 + (if (result i32) + (i32.const 1) (get_local $0) + (get_local $1) ) ) (drop @@ -1050,10 +1050,11 @@ (local $0 i32) (local $1 i32) (loop $top - (if - (i32.const 1) - (tee_local $0 + (set_local $0 + (if (result i32) + (i32.const 1) (unreachable) + (get_local $0) ) ) (drop @@ -1090,10 +1091,10 @@ (local $1 i32) (loop $top (drop - (if (result i32) - (i32.const 1) - (get_local $0) - (tee_local $0 + (tee_local $0 + (if (result i32) + (i32.const 1) + (get_local $0) (i32.const 2) ) ) @@ -1127,10 +1128,10 @@ ) (func $tee_if_with_unreachable_else (; 50 ;) (type $8) (param $0 f64) (param $1 i32) (result i64) (call $tee_if_with_unreachable_else - (if (result f64) - (get_local $1) - (get_local $0) - (tee_local $0 + (tee_local $0 + (if (result f64) + (get_local $1) + (get_local $0) (unreachable) ) ) @@ -1142,12 +1143,12 @@ ) (func $tee_if_with_unreachable_true (; 51 ;) (type $8) (param $0 f64) (param $1 i32) (result i64) (call $tee_if_with_unreachable_else - (if (result f64) - (get_local $1) - (tee_local $0 + (tee_local $0 + (if (result f64) + (get_local $1) (unreachable) + (get_local $0) ) - (get_local $0) ) (f64.lt (f64.const -128) diff --git a/test/passes/remove-unused-brs.txt b/test/passes/remove-unused-brs.txt index 774110e23..19773b7f6 100644 --- a/test/passes/remove-unused-brs.txt +++ b/test/passes/remove-unused-brs.txt @@ -2231,4 +2231,160 @@ ) ) ) + (func $selectify (; 102 ;) (type $0) (param $x i32) + (drop + (if (result i32) + (i32.eq + (get_local $x) + (i32.const 1) + ) + (i32.mul + (i32.const 2) + (i32.const 3) + ) + (i32.mul + (i32.const 2) + (i32.const 3) + ) + ) + ) + (drop + (if (result i32) + (i32.eq + (get_local $x) + (i32.const 1) + ) + (i32.add + (i32.const 2) + (i32.const 3) + ) + (i32.add + (i32.const 2) + (i32.const 3) + ) + ) + ) + ) + (func $if-one-side (; 103 ;) (type $2) (result i32) + (local $x i32) + (if + (i32.const 1) + (set_local $x + (i32.const 2) + ) + ) + (get_local $x) + ) + (func $if-one-side-b (; 104 ;) (type $2) (result i32) + (local $x i32) + (if + (i32.eqz + (i32.const 1) + ) + (set_local $x + (i32.const 2) + ) + ) + (get_local $x) + ) + (func $if-one-side-tee-etc (; 105 ;) (type $10) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $x i32) + (local $y i32) + (local $z i32) + (drop + (call $if-one-side-tee-etc + (block (result i32) + (if + (i32.const -3) + (set_local $x + (i32.const -4) + ) + ) + (get_local $x) + ) + ) + ) + (i32.const 0) + ) + (func $ifs-copies-recursive (; 106 ;) (type $10) (param $20 i32) (result i32) + (if + (i32.const 1) + (if + (i32.const 2) + (if + (i32.const 3) + (set_local $20 + (i32.const 4) + ) + ) + ) + ) + (get_local $20) + ) + (func $if-copy1 (; 107 ;) (type $1) + (local $x i32) + (local $y i32) + (loop $top + (if + (i32.eqz + (i32.const 1) + ) + (set_local $x + (get_local $y) + ) + ) + (br $top) + ) + ) + (func $if-copy3 (; 108 ;) (type $1) + (local $x i32) + (local $y i32) + (loop $top + (if + (i32.const 1) + (tee_local $x + (unreachable) + ) + ) + (br $top) + ) + ) + (func $if-copy4 (; 109 ;) (type $1) + (local $x i32) + (local $y i32) + (loop $top + (set_local $x + (if (result i32) + (i32.const 1) + (unreachable) + (get_local $y) + ) + ) + (br $top) + ) + ) + (func $if-copy-tee (; 110 ;) (type $1) + (local $x i32) + (local $y i32) + (loop $top + (drop + (block (result i32) + (if + (i32.eqz + (i32.const 1) + ) + (set_local $x + (i32.const 2) + ) + ) + (get_local $x) + ) + ) + (br $top) + ) + ) ) diff --git a/test/passes/remove-unused-brs.wast b/test/passes/remove-unused-brs.wast index d1afba4a5..fe195317d 100644 --- a/test/passes/remove-unused-brs.wast +++ b/test/passes/remove-unused-brs.wast @@ -1837,5 +1837,158 @@ ) ) ) + (func $selectify (param $x i32) + (drop + (if (result i32) + (i32.eq + (get_local $x) + (i32.const 1) + ) + (i32.mul + (i32.const 2) + (i32.const 3) + ) + (i32.mul + (i32.const 2) + (i32.const 3) + ) + ) + ) + (drop + (if (result i32) + (i32.eq + (get_local $x) + (i32.const 1) + ) + (i32.add + (i32.const 2) + (i32.const 3) + ) + (i32.add + (i32.const 2) + (i32.const 3) + ) + ) + ) + ) + (func $if-one-side (result i32) + (local $x i32) + (set_local $x + (if (result i32) + (i32.const 1) + (i32.const 2) + (get_local $x) + ) + ) + (get_local $x) + ) + (func $if-one-side-b (result i32) + (local $x i32) + (set_local $x + (if (result i32) + (i32.const 1) + (get_local $x) + (i32.const 2) + ) + ) + (get_local $x) + ) + (func $if-one-side-tee-etc (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $x i32) + (local $y i32) + (local $z i32) + (drop + (call $if-one-side-tee-etc + (tee_local $x + (if (result i32) + (i32.const -3) + (i32.const -4) + (get_local $x) + ) + ) + ) + ) + (i32.const 0) + ) + (func $ifs-copies-recursive (param $20 i32) (result i32) + (set_local $20 + (if (result i32) + (i32.const 1) + (if (result i32) + (i32.const 2) + (if (result i32) + (i32.const 3) + (i32.const 4) + (get_local $20) + ) + (get_local $20) + ) + (get_local $20) + ) + ) + (get_local $20) + ) + (func $if-copy1 + (local $x i32) + (local $y i32) + (loop $top + (set_local $x + (if (result i32) + (i32.const 1) + (get_local $x) + (get_local $y) + ) + ) + (br $top) + ) + ) + (func $if-copy3 + (local $x i32) + (local $y i32) + (loop $top + (set_local $x + (if (result i32) + (i32.const 1) + (unreachable) + (get_local $x) + ) + ) + (br $top) + ) + ) + (func $if-copy4 + (local $x i32) + (local $y i32) + (loop $top + (set_local $x + (if (result i32) + (i32.const 1) + (unreachable) + (get_local $y) + ) + ) + (br $top) + ) + ) + (func $if-copy-tee + (local $x i32) + (local $y i32) + (loop $top + (drop + (tee_local $x + (if (result i32) + (i32.const 1) + (get_local $x) + (i32.const 2) + ) + ) + ) + (br $top) + ) + ) ) |