summaryrefslogtreecommitdiff
path: root/test/lit/passes
diff options
context:
space:
mode:
Diffstat (limited to 'test/lit/passes')
-rw-r--r--test/lit/passes/coalesce-locals-gc-nn.wast26
-rw-r--r--test/lit/passes/inlining-gc.wast2
-rw-r--r--test/lit/passes/local-subtyping-nn.wast3
-rw-r--r--test/lit/passes/optimize-instructions-gc-tnh-nn.wast40
-rw-r--r--test/lit/passes/optimize-instructions-gc-tnh.wast49
-rw-r--r--test/lit/passes/ssa-gc-nn-locals.wast7
6 files changed, 55 insertions, 72 deletions
diff --git a/test/lit/passes/coalesce-locals-gc-nn.wast b/test/lit/passes/coalesce-locals-gc-nn.wast
index 32a34e016..4dfce0242 100644
--- a/test/lit/passes/coalesce-locals-gc-nn.wast
+++ b/test/lit/passes/coalesce-locals-gc-nn.wast
@@ -1,6 +1,5 @@
;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.
-;; RUN: wasm-opt %s --coalesce-locals -all --enable-gc-nn-locals -S -o - \
-;; RUN: | filecheck %s
+;; RUN: wasm-opt %s --coalesce-locals -all -S -o - | filecheck %s
(module
;; CHECK: (func $nn-locals (type $0) (param $0 (ref any))
@@ -81,27 +80,4 @@
)
)
)
-
- ;; CHECK: (func $unreachable-get-of-non-nullable (type $1)
- ;; CHECK-NEXT: (local $0 (ref any))
- ;; CHECK-NEXT: (unreachable)
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (block (result (ref any))
- ;; CHECK-NEXT: (unreachable)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- (func $unreachable-get-of-non-nullable
- ;; One local is unused entirely, the other is used but only in unreachable
- ;; code. It does not really matter what we do here (coalesce, or not), but we
- ;; should emit valid IR. Normally we would apply a constant to replace the
- ;; local.get, however, the types here are non-nullable, so we must do
- ;; something else.
- (local $unused (ref any))
- (local $used-in-unreachable (ref any))
- (unreachable)
- (drop
- (local.get $used-in-unreachable)
- )
- )
)
diff --git a/test/lit/passes/inlining-gc.wast b/test/lit/passes/inlining-gc.wast
index 92267519a..8da522e1d 100644
--- a/test/lit/passes/inlining-gc.wast
+++ b/test/lit/passes/inlining-gc.wast
@@ -1,5 +1,5 @@
;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.
-;; RUN: wasm-opt %s --inlining --enable-gc-nn-locals -all -S -o - | filecheck %s
+;; RUN: wasm-opt %s --inlining -all -S -o - | filecheck %s
(module
;; CHECK: (func $caller-nullable (type $0)
diff --git a/test/lit/passes/local-subtyping-nn.wast b/test/lit/passes/local-subtyping-nn.wast
index c017fb35b..04cade7e0 100644
--- a/test/lit/passes/local-subtyping-nn.wast
+++ b/test/lit/passes/local-subtyping-nn.wast
@@ -1,6 +1,5 @@
;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.
-;; RUN: wasm-opt %s --local-subtyping -all --enable-gc-nn-locals -S -o - \
-;; RUN: | filecheck %s
+;; RUN: wasm-opt %s --local-subtyping -all -S -o - | filecheck %s
(module
(type $struct (struct))
diff --git a/test/lit/passes/optimize-instructions-gc-tnh-nn.wast b/test/lit/passes/optimize-instructions-gc-tnh-nn.wast
deleted file mode 100644
index c5692a692..000000000
--- a/test/lit/passes/optimize-instructions-gc-tnh-nn.wast
+++ /dev/null
@@ -1,40 +0,0 @@
-;; 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 (type $0)
- ;; 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-tnh.wast b/test/lit/passes/optimize-instructions-gc-tnh.wast
index d56b296da..28177f306 100644
--- a/test/lit/passes/optimize-instructions-gc-tnh.wast
+++ b/test/lit/passes/optimize-instructions-gc-tnh.wast
@@ -977,6 +977,55 @@
)
)
+ ;; TNH: (func $set-of-as-non-null (type $void)
+ ;; TNH-NEXT: (local $x anyref)
+ ;; TNH-NEXT: (local.set $x
+ ;; TNH-NEXT: (local.get $x)
+ ;; TNH-NEXT: )
+ ;; TNH-NEXT: (drop
+ ;; TNH-NEXT: (ref.as_non_null
+ ;; TNH-NEXT: (local.tee $x
+ ;; TNH-NEXT: (local.get $x)
+ ;; TNH-NEXT: )
+ ;; TNH-NEXT: )
+ ;; TNH-NEXT: )
+ ;; TNH-NEXT: )
+ ;; NO_TNH: (func $set-of-as-non-null (type $void)
+ ;; NO_TNH-NEXT: (local $x anyref)
+ ;; NO_TNH-NEXT: (local.set $x
+ ;; NO_TNH-NEXT: (ref.as_non_null
+ ;; NO_TNH-NEXT: (local.get $x)
+ ;; NO_TNH-NEXT: )
+ ;; NO_TNH-NEXT: )
+ ;; NO_TNH-NEXT: (drop
+ ;; NO_TNH-NEXT: (ref.as_non_null
+ ;; NO_TNH-NEXT: (local.tee $x
+ ;; NO_TNH-NEXT: (local.get $x)
+ ;; NO_TNH-NEXT: )
+ ;; NO_TNH-NEXT: )
+ ;; NO_TNH-NEXT: )
+ ;; NO_TNH-NEXT: )
+ (func $set-of-as-non-null
+ (local $x anyref)
+ ;; We can remove the ref.as_non_null here because the local is nullable and
+ ;; we are ignoring traps.
+ ;; TODO: Should we keep the cast to let us refine the local 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)
+ )
+ )
+ )
+ )
+
+
;; Helper functions.
;; TNH: (func $get-i32 (type $2) (result i32)
diff --git a/test/lit/passes/ssa-gc-nn-locals.wast b/test/lit/passes/ssa-gc-nn-locals.wast
index be4a5aee9..2ed36340e 100644
--- a/test/lit/passes/ssa-gc-nn-locals.wast
+++ b/test/lit/passes/ssa-gc-nn-locals.wast
@@ -1,7 +1,7 @@
;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.
;; -g --roundtrip are added to show that we properly handle non-nullable locals
;; through the binary format as well (-g is for the function names).
-;; RUN: wasm-opt %s -all --ssa --enable-gc-nn-locals -g --roundtrip -S -o - | filecheck %s
+;; RUN: wasm-opt %s -all --ssa -g --roundtrip -S -o - | filecheck %s
(module
;; CHECK: (func $nn-locals (type $0)
@@ -19,9 +19,8 @@
(func $nn-locals
;; A non-nullable local
(local $x (ref func))
- ;; Set the local, and get it later. The SSA pass will normally handle non-
- ;; nullability using ref.as_non_null, but with --gc-nn-locals nothing should
- ;; be done.
+ ;; Set the local, and get it later. The SSA pass handles non- nullability
+ ;; using ref.as_non_null.
(local.set $x (ref.func $nn-locals))
(drop (local.get $x))
(drop (local.get $x))