summaryrefslogtreecommitdiff
path: root/test/lit
diff options
context:
space:
mode:
Diffstat (limited to 'test/lit')
-rw-r--r--test/lit/global-only.wast13
-rw-r--r--test/lit/passes/dae_all-features.wast4
-rw-r--r--test/lit/passes/precompute-gc-immutable.wast3
-rw-r--r--test/lit/passes/roundtrip-gc-types.wast6
4 files changed, 20 insertions, 6 deletions
diff --git a/test/lit/global-only.wast b/test/lit/global-only.wast
new file mode 100644
index 000000000..6dce13d6d
--- /dev/null
+++ b/test/lit/global-only.wast
@@ -0,0 +1,13 @@
+;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
+
+;; Regression test for a bug where types on globals were not collected, so if
+;; they weren't used anywhere else they were not emitted in the output.
+
+;; RUN: wasm-opt -all %s -S -o - | filecheck %s
+
+(module $parse
+ ;; CHECK: (type $t (struct ))
+ (type $t (struct))
+ ;; CHECK: (global $g (ref null $t) (ref.null $t))
+ (global $g (ref null $t) (ref.null $t))
+)
diff --git a/test/lit/passes/dae_all-features.wast b/test/lit/passes/dae_all-features.wast
index 41655d849..92268dbbc 100644
--- a/test/lit/passes/dae_all-features.wast
+++ b/test/lit/passes/dae_all-features.wast
@@ -479,10 +479,10 @@
;; CHECK-NEXT: (ref.func $0)
;; CHECK-NEXT: )
(module
- ;; CHECK: (type $none_=>_none (func))
-
;; CHECK: (type $i64 (func (param i64)))
(type $i64 (func (param i64)))
+ ;; CHECK: (type $none_=>_none (func))
+
;; CHECK: (global $global$0 (ref $i64) (ref.func $0))
(global $global$0 (ref $i64) (ref.func $0))
;; CHECK: (export "even" (func $1))
diff --git a/test/lit/passes/precompute-gc-immutable.wast b/test/lit/passes/precompute-gc-immutable.wast
index 0fd4e822d..8b5f28597 100644
--- a/test/lit/passes/precompute-gc-immutable.wast
+++ b/test/lit/passes/precompute-gc-immutable.wast
@@ -664,10 +664,9 @@
;; Create an immutable vtable in an immutable global, but using an array
;; instead of a struct.
- ;; CHECK: (type $object (struct_subtype (field (ref $vtable)) data))
-
;; CHECK: (type $vtable (array_subtype funcref data))
(type $vtable (array_subtype funcref data))
+ ;; CHECK: (type $object (struct_subtype (field (ref $vtable)) data))
(type $object (struct_subtype (ref $vtable) data))
;; CHECK: (global $vtable (ref $vtable) (array.init_static $vtable
diff --git a/test/lit/passes/roundtrip-gc-types.wast b/test/lit/passes/roundtrip-gc-types.wast
index d14415f3b..24d0ef40c 100644
--- a/test/lit/passes/roundtrip-gc-types.wast
+++ b/test/lit/passes/roundtrip-gc-types.wast
@@ -10,16 +10,18 @@
;; CHECK: (type $A (struct (field (ref $C))))
;; NOMNL: (type $A (struct_subtype (field (ref $C)) data))
(type $A (struct (field (ref $C))))
+ ;; CHECK: (type $D (struct (field (ref $C)) (field (ref $A))))
+
;; CHECK: (type $C (struct (field (mut (ref $B)))))
;; CHECK: (type $B (func (param (ref $A)) (result (ref $B))))
+ ;; NOMNL: (type $D (struct_subtype (field (ref $C)) (field (ref $A)) $A))
+
;; NOMNL: (type $C (struct_subtype (field (mut (ref $B))) data))
;; NOMNL: (type $B (func_subtype (param (ref $A)) (result (ref $B)) func))
(type $B (func (param (ref $A)) (result (ref $B))))
(type $C (struct (field (mut (ref $B)))))
- ;; CHECK: (type $D (struct (field (ref $C)) (field (ref $A))))
- ;; NOMNL: (type $D (struct_subtype (field (ref $C)) (field (ref $A)) $A))
(type $D (struct_subtype (field (ref $C)) (field (ref $A)) $A))
;; CHECK: (global $g0 (rtt 0 $A) (rtt.canon $A))
;; NOMNL: (global $g0 (rtt 0 $A) (rtt.canon $A))