|
3 | 3 | ;; Run without global effects, and run with, and also run with but discard them
|
4 | 4 | ;; first (to check that discard works; that should be the same as without).
|
5 | 5 |
|
6 |
| -;; RUN: foreach %s %t wasm-opt --vacuum -S -o - | filecheck %s --check-prefix WITHOUT |
7 |
| -;; RUN: foreach %s %t wasm-opt --generate-global-effects --vacuum -S -o - | filecheck %s --check-prefix INCLUDE |
8 |
| -;; RUN: foreach %s %t wasm-opt --generate-global-effects --discard-global-effects --vacuum -S -o - | filecheck %s --check-prefix DISCARD |
| 6 | +;; RUN: foreach %s %t wasm-opt -all --vacuum -S -o - | filecheck %s --check-prefix WITHOUT |
| 7 | +;; RUN: foreach %s %t wasm-opt -all --generate-global-effects --vacuum -S -o - | filecheck %s --check-prefix INCLUDE |
| 8 | +;; RUN: foreach %s %t wasm-opt -all --generate-global-effects --discard-global-effects --vacuum -S -o - | filecheck %s --check-prefix DISCARD |
9 | 9 |
|
10 | 10 | (module
|
11 | 11 | ;; WITHOUT: (type $none_=>_none (func))
|
12 | 12 |
|
13 | 13 | ;; WITHOUT: (type $none_=>_i32 (func (result i32)))
|
14 | 14 |
|
| 15 | + ;; WITHOUT: (tag $tag (param)) |
| 16 | + ;; INCLUDE: (type $none_=>_none (func)) |
| 17 | + |
| 18 | + ;; INCLUDE: (type $none_=>_i32 (func (result i32))) |
| 19 | + |
| 20 | + ;; INCLUDE: (tag $tag (param)) |
| 21 | + ;; DISCARD: (type $none_=>_none (func)) |
| 22 | + |
| 23 | + ;; DISCARD: (type $none_=>_i32 (func (result i32))) |
| 24 | + |
| 25 | + ;; DISCARD: (tag $tag (param)) |
| 26 | + (tag $tag) |
| 27 | + |
15 | 28 | ;; WITHOUT: (func $foo
|
16 | 29 | ;; WITHOUT-NEXT: (call $nop)
|
17 | 30 | ;; WITHOUT-NEXT: (call $unreachable)
|
|
21 | 34 | ;; WITHOUT-NEXT: (call $unimportant-effects)
|
22 | 35 | ;; WITHOUT-NEXT: )
|
23 | 36 | ;; WITHOUT-NEXT: )
|
24 |
| - ;; INCLUDE: (type $none_=>_none (func)) |
25 |
| - |
26 |
| - ;; INCLUDE: (type $none_=>_i32 (func (result i32))) |
27 |
| - |
28 | 37 | ;; INCLUDE: (func $foo
|
29 | 38 | ;; INCLUDE-NEXT: (call $unreachable)
|
30 | 39 | ;; INCLUDE-NEXT: (call $call-nop)
|
31 | 40 | ;; INCLUDE-NEXT: (call $call-unreachable)
|
32 | 41 | ;; INCLUDE-NEXT: )
|
33 |
| - ;; DISCARD: (type $none_=>_none (func)) |
34 |
| - |
35 |
| - ;; DISCARD: (type $none_=>_i32 (func (result i32))) |
36 |
| - |
37 | 42 | ;; DISCARD: (func $foo
|
38 | 43 | ;; DISCARD-NEXT: (call $nop)
|
39 | 44 | ;; DISCARD-NEXT: (call $unreachable)
|
|
169 | 174 | (local.get $x)
|
170 | 175 | )
|
171 | 176 | )
|
| 177 | + |
| 178 | + ;; WITHOUT: (func $call-throws-and-catch |
| 179 | + ;; WITHOUT-NEXT: (try $try |
| 180 | + ;; WITHOUT-NEXT: (do |
| 181 | + ;; WITHOUT-NEXT: (call $throw) |
| 182 | + ;; WITHOUT-NEXT: ) |
| 183 | + ;; WITHOUT-NEXT: (catch_all |
| 184 | + ;; WITHOUT-NEXT: (nop) |
| 185 | + ;; WITHOUT-NEXT: ) |
| 186 | + ;; WITHOUT-NEXT: ) |
| 187 | + ;; WITHOUT-NEXT: ) |
| 188 | + ;; INCLUDE: (func $call-throws-and-catch |
| 189 | + ;; INCLUDE-NEXT: (nop) |
| 190 | + ;; INCLUDE-NEXT: ) |
| 191 | + ;; DISCARD: (func $call-throws-and-catch |
| 192 | + ;; DISCARD-NEXT: (try $try |
| 193 | + ;; DISCARD-NEXT: (do |
| 194 | + ;; DISCARD-NEXT: (call $throw) |
| 195 | + ;; DISCARD-NEXT: ) |
| 196 | + ;; DISCARD-NEXT: (catch_all |
| 197 | + ;; DISCARD-NEXT: (nop) |
| 198 | + ;; DISCARD-NEXT: ) |
| 199 | + ;; DISCARD-NEXT: ) |
| 200 | + ;; DISCARD-NEXT: ) |
| 201 | + (func $call-throws-and-catch |
| 202 | + (try |
| 203 | + (do |
| 204 | + ;; This call cannot be optimized out, as the target throws. However, the |
| 205 | + ;; entire try-catch can be, since the call's only effect is to throw, |
| 206 | + ;; and the catch_all catches that. |
| 207 | + (call $throw) |
| 208 | + ) |
| 209 | + (catch_all) |
| 210 | + ) |
| 211 | + ) |
| 212 | + |
| 213 | + ;; WITHOUT: (func $throw |
| 214 | + ;; WITHOUT-NEXT: (throw $tag) |
| 215 | + ;; WITHOUT-NEXT: ) |
| 216 | + ;; INCLUDE: (func $throw |
| 217 | + ;; INCLUDE-NEXT: (throw $tag) |
| 218 | + ;; INCLUDE-NEXT: ) |
| 219 | + ;; DISCARD: (func $throw |
| 220 | + ;; DISCARD-NEXT: (throw $tag) |
| 221 | + ;; DISCARD-NEXT: ) |
| 222 | + (func $throw |
| 223 | + (throw $tag) |
| 224 | + ) |
172 | 225 | )
|
0 commit comments