summaryrefslogtreecommitdiff
path: root/test/lit/passes/simplify-locals-gc-nn.wast
diff options
context:
space:
mode:
Diffstat (limited to 'test/lit/passes/simplify-locals-gc-nn.wast')
-rw-r--r--test/lit/passes/simplify-locals-gc-nn.wast99
1 files changed, 17 insertions, 82 deletions
diff --git a/test/lit/passes/simplify-locals-gc-nn.wast b/test/lit/passes/simplify-locals-gc-nn.wast
index 814350fc0..e5941cc0e 100644
--- a/test/lit/passes/simplify-locals-gc-nn.wast
+++ b/test/lit/passes/simplify-locals-gc-nn.wast
@@ -1,33 +1,34 @@
;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.
-;; RUN: wasm-opt %s --simplify-locals -all --enable-gc-nn-locals -S -o - | filecheck %s
+;; RUN: wasm-opt %s --simplify-locals -all -S -o - | filecheck %s
(module
;; CHECK: (func $test-nn
- ;; CHECK-NEXT: (local $nn (ref any))
- ;; CHECK-NEXT: (local.set $nn
- ;; CHECK-NEXT: (ref.as_non_null
- ;; CHECK-NEXT: (ref.null any)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local $nn anyref)
+ ;; CHECK-NEXT: (nop)
;; CHECK-NEXT: (try $try
;; CHECK-NEXT: (do
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (local.get $nn)
+ ;; CHECK-NEXT: (local.set $nn
+ ;; CHECK-NEXT: (ref.as_non_null
+ ;; CHECK-NEXT: (ref.null any)
+ ;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (catch_all
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (local.get $nn)
+ ;; CHECK-NEXT: (ref.as_non_null
+ ;; CHECK-NEXT: (local.get $nn)
+ ;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $test-nn
(local $nn (ref any))
- ;; We should not sink this set into the try, as the spec does not allow it
- ;; even though we are not changing dominance (we are not changing it,
- ;; because there is nothing that can throw in the try's body that can reach
- ;; the catch_all before the local.set that we move there). See
+ ;; We can sink this set into the try, but the spec does not allow it to
+ ;; remain non-nullable. Even though we are not changing dominance (we are
+ ;; not changing it, because there is nothing that can throw in the try's
+ ;; body that can reach the catch_all before the local.set that we move
+ ;; there). See
;; https://github.com/WebAssembly/function-references/issues/44#issuecomment-1083146887
(local.set $nn
(ref.as_non_null
@@ -67,8 +68,8 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $test-nullable
- ;; As above, but now the local is nullable. Here we *can* optimize the set
- ;; into the try.
+ ;; As above, but now the local is nullable. Here we can optimize the set
+ ;; into the try, with no other necessary changes.
(local $nullable (ref null any))
(local.set $nullable
(ref.as_non_null
@@ -88,70 +89,4 @@
)
)
)
-
- ;; CHECK: (func $test-nested-nn
- ;; CHECK-NEXT: (local $nullable anyref)
- ;; CHECK-NEXT: (local $nn (ref any))
- ;; CHECK-NEXT: (local.set $nullable
- ;; CHECK-NEXT: (block (result (ref any))
- ;; CHECK-NEXT: (local.set $nn
- ;; CHECK-NEXT: (ref.as_non_null
- ;; CHECK-NEXT: (ref.null any)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (ref.as_non_null
- ;; CHECK-NEXT: (ref.null any)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (try $try
- ;; CHECK-NEXT: (do
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (local.get $nullable)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (catch_all
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (local.get $nullable)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (local.get $nn)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- (func $test-nested-nn
- ;; As above, the set we want to move is nullable, but now it has a nested
- ;; value that is a non-nullable set. That should also prevent us from
- ;; moving it.
- (local $nullable (ref null any))
- (local $nn (ref any))
- (local.set $nullable
- (block (result (ref any))
- (local.set $nn
- (ref.as_non_null
- (ref.null any)
- )
- )
- (ref.as_non_null
- (ref.null any)
- )
- )
- )
- (try
- (do
- (drop
- (local.get $nullable)
- )
- )
- (catch_all
- (drop
- (local.get $nullable)
- )
- (drop
- (local.get $nn)
- )
- )
- )
- )
)