diff options
author | Alon Zakai <azakai@google.com> | 2021-05-10 15:07:35 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-10 15:07:35 -0700 |
commit | 08e0a3cdc5303f6906bb807de3ad9ed9e2cbdb51 (patch) | |
tree | 69791163aa63c401d1ba2c2882a198a181b012d1 /test | |
parent | 5499ef491a264b02d24180f5dad824feec52074a (diff) | |
download | binaryen-08e0a3cdc5303f6906bb807de3ad9ed9e2cbdb51.tar.gz binaryen-08e0a3cdc5303f6906bb807de3ad9ed9e2cbdb51.tar.bz2 binaryen-08e0a3cdc5303f6906bb807de3ad9ed9e2cbdb51.zip |
Implement all Builder::replaceWithIdenticalType() cases as best we can (#3872)
The method had TODOs which it halted on. But we should not halt the
entire program, as this is a best-effort attempt to replace a node with
something simpler of the same type (we call it when we know the value
is not actually used).
Diffstat (limited to 'test')
-rw-r--r-- | test/lit/passes/coalesce-locals-gc.wast | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/lit/passes/coalesce-locals-gc.wast b/test/lit/passes/coalesce-locals-gc.wast new file mode 100644 index 000000000..5bad35001 --- /dev/null +++ b/test/lit/passes/coalesce-locals-gc.wast @@ -0,0 +1,21 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. +;; RUN: wasm-opt %s --coalesce-locals -all -S -o - \ +;; RUN: | filecheck %s + +(module + ;; CHECK: (func $test-dead-get-non-nullable (param $0 dataref) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $test-dead-get-non-nullable (param $func (ref data)) + (unreachable) + (drop + ;; A useless get (that does not read from any set, or from the inputs to the + ;; function). Normally we replace such gets with nops as best we can, but in + ;; this case the type is non-nullable, so we must leave it alone. + (local.get $func) + ) + ) +) |