| ;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. |
| ;; RUN: foreach %s %t wasm-opt -all --generate-global-effects --vacuum -S -o - | filecheck %s --check-prefix INCLUDE |
| |
| (module |
| |
| ;; INCLUDE: (type $void (func)) |
| (type $void (func)) |
| |
| |
| |
| ;; INCLUDE: (import "a" "b" (func $import (type $void))) |
| (import "a" "b" (func $import)) |
| |
| ;; INCLUDE: (table $t 0 funcref) |
| (table $t 0 funcref) |
| |
| |
| ;; INCLUDE: (tag $tag (type $void)) |
| (tag $tag) |
| |
| ;; INCLUDE: (func $main (type $void) |
| ;; INCLUDE-NEXT: (call $call-unreachable) |
| ;; INCLUDE-NEXT: ) |
| (func $main |
| ;; Calling a function with no effects can be optimized away in INCLUDE (but |
| (call $nop) |
| (call $call-nop) |
| |
| (call $call-unreachable) |
| ;; Calling a function with effects cannot. |
| ;; (call $unreachable) |
| ;; ;; Calling something that calls something with no effects can be optimized |
| ;; ;; away, since we compute transitive effects |
| ;; (call $call-nop) |
| ;; ;; Calling something that calls something with effects cannot. |
| ;; (call $call-unreachable) |
| ;; ;; Calling something that only has unimportant effects can be optimized |
| ;; ;; (see below for details). |
| ;; (drop |
| ;; (call $unimportant-effects) |
| ;; ) |
| ;; ;; A throwing function cannot be removed. |
| ;; (call $throw) |
| ;; ;; A function that throws and calls an import definitely cannot be removed. |
| ;; (call $throw-and-import) |
| ) |
| |
| ;; INCLUDE: (func $nop (type $void) |
| ;; INCLUDE-NEXT: (nop) |
| ;; INCLUDE-NEXT: ) |
| (func $nop |
| (nop) |
| ) |
| |
| ;; INCLUDE: (func $call-nop (type $void) |
| ;; INCLUDE-NEXT: (nop) |
| ;; INCLUDE-NEXT: ) |
| (func $call-nop |
| ;; This call to a nop can be optimized out, as above, in INCLUDE. |
| (call $nop) |
| ) |
| |
| ;; INCLUDE: (func $call-unreachable (type $void) |
| ;; INCLUDE-NEXT: (call $unreachable) |
| ;; INCLUDE-NEXT: ) |
| (func $call-unreachable |
| (call $unreachable) |
| ) |
| |
| ;; INCLUDE: (func $unreachable (type $void) |
| ;; INCLUDE-NEXT: (unreachable) |
| ;; INCLUDE-NEXT: ) |
| (func $unreachable |
| (unreachable) |
| ) |
| ) |
| |