diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/lit/passes/optimize-instructions-gc-iit.wast | 24 | ||||
-rw-r--r-- | test/lit/passes/optimize-instructions-gc-tnh-nn.wast | 40 | ||||
-rw-r--r-- | test/lit/passes/optimize-instructions-gc.wast | 1 |
3 files changed, 64 insertions, 1 deletions
diff --git a/test/lit/passes/optimize-instructions-gc-iit.wast b/test/lit/passes/optimize-instructions-gc-iit.wast index 41d4e69d5..b99042643 100644 --- a/test/lit/passes/optimize-instructions-gc-iit.wast +++ b/test/lit/passes/optimize-instructions-gc-iit.wast @@ -342,4 +342,28 @@ ) ) ) + + ;; CHECK: (func $set-of-as-non-null (param $x anyref) + ;; CHECK-NEXT: (local.set $x + ;; CHECK-NEXT: (local.get $x) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; NOMNL: (func $set-of-as-non-null (param $x anyref) + ;; NOMNL-NEXT: (local.set $x + ;; NOMNL-NEXT: (local.get $x) + ;; NOMNL-NEXT: ) + ;; NOMNL-NEXT: ) + ;; NOMNL-TNH: (func $set-of-as-non-null (param $x anyref) + ;; NOMNL-TNH-NEXT: (local.set $x + ;; NOMNL-TNH-NEXT: (local.get $x) + ;; NOMNL-TNH-NEXT: ) + ;; NOMNL-TNH-NEXT: ) + (func $set-of-as-non-null (param $x anyref) + ;; As we ignore such traps, we can remove the ref.as here. + (local.set $x + (ref.as_non_null + (local.get $x) + ) + ) + ) ) diff --git a/test/lit/passes/optimize-instructions-gc-tnh-nn.wast b/test/lit/passes/optimize-instructions-gc-tnh-nn.wast new file mode 100644 index 000000000..e0a580ae1 --- /dev/null +++ b/test/lit/passes/optimize-instructions-gc-tnh-nn.wast @@ -0,0 +1,40 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. +;; RUN: wasm-opt %s --optimize-instructions --traps-never-happen --enable-gc-nn-locals -all -S -o - \ +;; RUN: | filecheck %s + +(module + ;; CHECK: (func $set-of-as-non-null + ;; CHECK-NEXT: (local $x anyref) + ;; CHECK-NEXT: (local.set $x + ;; CHECK-NEXT: (ref.as_non_null + ;; CHECK-NEXT: (local.get $x) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (local.tee $x + ;; CHECK-NEXT: (ref.as_non_null + ;; CHECK-NEXT: (local.get $x) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $set-of-as-non-null + (local $x anyref) + ;; As we ignore such traps, we can in principle remove the ref.as here. + ;; However, as we allow non-nullable locals, we should not do that - if we + ;; did it it might prevent specializing the local type later. + (local.set $x + (ref.as_non_null + (local.get $x) + ) + ) + ;; The same for a tee. + (drop + (local.tee $x + (ref.as_non_null + (local.get $x) + ) + ) + ) + ) +) diff --git a/test/lit/passes/optimize-instructions-gc.wast b/test/lit/passes/optimize-instructions-gc.wast index a3f91c756..3f12f58e9 100644 --- a/test/lit/passes/optimize-instructions-gc.wast +++ b/test/lit/passes/optimize-instructions-gc.wast @@ -1247,7 +1247,6 @@ (ref.as_non_null (local.get $x) ) - (rtt.canon $struct) ) ) ) |