diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/passes/remove-unused-names_code-folding_all-features.txt (renamed from test/passes/remove-unused-names_code-folding.txt) | 75 | ||||
-rw-r--r-- | test/passes/remove-unused-names_code-folding_all-features.wast (renamed from test/passes/remove-unused-names_code-folding.wast) | 50 |
2 files changed, 125 insertions, 0 deletions
diff --git a/test/passes/remove-unused-names_code-folding.txt b/test/passes/remove-unused-names_code-folding_all-features.txt index 93f503579..2aa40da24 100644 --- a/test/passes/remove-unused-names_code-folding.txt +++ b/test/passes/remove-unused-names_code-folding_all-features.txt @@ -3,6 +3,7 @@ (type $none_=>_i32 (func (result i32))) (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) + (event $e (attr 0) (param)) (func $ifs (; 0 ;) (if (i32.const 0) @@ -1708,4 +1709,78 @@ (i32.const 2) ) ) + (func $exnref_pop_test (; 36 ;) + (local $exn exnref) + (block $folding-inner0 + (try + (try + (nop) + (catch + (local.set $exn + (exnref.pop) + ) + (br $folding-inner0) + ) + ) + (catch + (local.set $exn + (exnref.pop) + ) + (br $folding-inner0) + ) + ) + (return) + ) + (drop + (i32.const 111) + ) + (drop + (i32.const 222) + ) + (drop + (i32.const 333) + ) + (unreachable) + ) + (func $br_on_exn_target_block (; 37 ;) + (local $exn exnref) + (block $x + (if + (i32.const 0) + (block + (drop + (i32.const 1) + ) + (drop + (i32.const 2) + ) + (br $x) + ) + ) + (if + (i32.const 0) + (block + (drop + (i32.const 1) + ) + (drop + (i32.const 2) + ) + (br $x) + ) + ) + (drop + (br_on_exn $x $e + (local.get $exn) + ) + ) + (drop + (i32.const 1) + ) + (drop + (i32.const 2) + ) + (br $x) + ) + ) ) diff --git a/test/passes/remove-unused-names_code-folding.wast b/test/passes/remove-unused-names_code-folding_all-features.wast index 9979a0a3c..ad803864e 100644 --- a/test/passes/remove-unused-names_code-folding.wast +++ b/test/passes/remove-unused-names_code-folding_all-features.wast @@ -1191,4 +1191,54 @@ ) ) ) + + (func $exnref_pop_test (local $exn exnref) + (try + (try + (catch + ;; Expressions containing exnref.pop should NOT be taken out and + ;; folded. + (local.set $exn (exnref.pop)) + (drop (i32.const 111)) + (drop (i32.const 222)) + (drop (i32.const 333)) + (unreachable) + ) + ) + (catch + (local.set $exn (exnref.pop)) + (drop (i32.const 111)) + (drop (i32.const 222)) + (drop (i32.const 333)) + (unreachable) + ) + ) + ) + + (event $e (attr 0)) ;; exception with no param + (func $br_on_exn_target_block (local $exn exnref) + ;; Here this block $x is targeted by br_on_exn, so code folding out of this + ;; block should NOT happen. + (block $x + (if (i32.const 0) + (block + (drop (i32.const 1)) + (drop (i32.const 2)) + (br $x) + ) + ) + (if (i32.const 0) + (block + (drop (i32.const 1)) + (drop (i32.const 2)) + (br $x) + ) + ) + (drop (br_on_exn $x $e (local.get $exn))) + ;; no fallthrough, another thing to merge + (drop (i32.const 1)) + (drop (i32.const 2)) + (br $x) + ) + ) ) |