summaryrefslogtreecommitdiff
path: root/test/lit
diff options
context:
space:
mode:
Diffstat (limited to 'test/lit')
-rw-r--r--test/lit/passes/ssa-gc-nn-locals.wast27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/lit/passes/ssa-gc-nn-locals.wast b/test/lit/passes/ssa-gc-nn-locals.wast
new file mode 100644
index 000000000..149a0c5c7
--- /dev/null
+++ b/test/lit/passes/ssa-gc-nn-locals.wast
@@ -0,0 +1,27 @@
+;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.
+;; RUN: wasm-opt %s -all --ssa --enable-gc-nn-locals -S -o - | filecheck %s
+
+(module
+ ;; CHECK: (func $nn-locals
+ ;; CHECK-NEXT: (local $x (ref func))
+ ;; CHECK-NEXT: (local.set $x
+ ;; CHECK-NEXT: (ref.func $nn-locals)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (local.get $x)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (local.get $x)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (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.
+ (local.set $x (ref.func $nn-locals))
+ (drop (local.get $x))
+ (drop (local.get $x))
+ )
+)