diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/lit/forward-declared-types.wast | 1 | ||||
-rw-r--r-- | test/lit/lub-bug-3843.wast | 3 | ||||
-rw-r--r-- | test/lit/nominal-chain.wast | 1 | ||||
-rw-r--r-- | test/lit/passes/coalesce-locals-eh.wast | 1 | ||||
-rw-r--r-- | test/lit/passes/dce-eh.wast | 1 | ||||
-rw-r--r-- | test/lit/passes/heap2local.wast | 2 | ||||
-rw-r--r-- | test/lit/passes/optimize-instructions-eh.wast | 1 | ||||
-rw-r--r-- | test/lit/passes/optimize-instructions-gc.wast | 2 | ||||
-rw-r--r-- | test/lit/passes/poppify-globals.wast | 29 | ||||
-rw-r--r-- | test/lit/passes/precompute-gc.wast | 2 | ||||
-rw-r--r-- | test/lit/passes/roundtrip-gc-types.wast | 1 | ||||
-rw-r--r-- | test/lit/recursive-types.wast | 48 |
12 files changed, 61 insertions, 31 deletions
diff --git a/test/lit/forward-declared-types.wast b/test/lit/forward-declared-types.wast index 876ebefd8..215838621 100644 --- a/test/lit/forward-declared-types.wast +++ b/test/lit/forward-declared-types.wast @@ -5,6 +5,7 @@ (module ;; CHECK: (type $func (func)) + ;; CHECK: (type $struct (struct (field (ref $array)) (field (ref null $func)))) (type $struct (struct (field (ref $array)) diff --git a/test/lit/lub-bug-3843.wast b/test/lit/lub-bug-3843.wast index 37206edc7..897149502 100644 --- a/test/lit/lub-bug-3843.wast +++ b/test/lit/lub-bug-3843.wast @@ -8,9 +8,12 @@ (module ;; CHECK: (type $A (struct (field (ref null $C)))) (type $A (struct (field (ref null $C)))) + ;; CHECK: (type $B (struct (field (ref null $D)))) (type $B (struct (field (ref null $D)))) + ;; CHECK: (type $D (struct (field (mut (ref $A))) (field (mut (ref $A))))) + ;; CHECK: (type $C (struct (field (mut (ref $A))))) (type $C (struct (field (mut (ref $A))))) (type $D (struct (field (mut (ref $A))) (field (mut (ref $A))))) diff --git a/test/lit/nominal-chain.wast b/test/lit/nominal-chain.wast index 5c5807a15..bf190d878 100644 --- a/test/lit/nominal-chain.wast +++ b/test/lit/nominal-chain.wast @@ -8,6 +8,7 @@ (module ;; CHECK: (type $root (struct )) + ;; CHECK: (type $leaf (struct (field i32) (field i64) (field f32) (field f64)) (extends $twig)) (type $leaf (struct i32 i64 f32 f64) (extends $twig)) diff --git a/test/lit/passes/coalesce-locals-eh.wast b/test/lit/passes/coalesce-locals-eh.wast index 20c1d3152..9a3289776 100644 --- a/test/lit/passes/coalesce-locals-eh.wast +++ b/test/lit/passes/coalesce-locals-eh.wast @@ -3,6 +3,7 @@ (module ;; CHECK: (tag $e (param)) + ;; CHECK: (func $bar (result i32) ;; CHECK-NEXT: (i32.const 1984) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/dce-eh.wast b/test/lit/passes/dce-eh.wast index e2268f87b..336246225 100644 --- a/test/lit/passes/dce-eh.wast +++ b/test/lit/passes/dce-eh.wast @@ -5,6 +5,7 @@ ;; reachable (module ;; CHECK: (tag $e (param)) + ;; CHECK: (func $foo ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/heap2local.wast b/test/lit/passes/heap2local.wast index efca63028..f7120906e 100644 --- a/test/lit/passes/heap2local.wast +++ b/test/lit/passes/heap2local.wast @@ -7,7 +7,9 @@ (type $struct.A (struct (field (mut i32)) (field (mut f64)))) ;; CHECK: (type $struct.recursive (struct (field (mut (ref null $struct.recursive))))) + ;; CHECK: (type $struct.nonnullable (struct (field (ref $struct.A)))) + ;; CHECK: (type $struct.packed (struct (field (mut i8)))) (type $struct.packed (struct (field (mut i8)))) diff --git a/test/lit/passes/optimize-instructions-eh.wast b/test/lit/passes/optimize-instructions-eh.wast index 92a2dd37c..7fd871c15 100644 --- a/test/lit/passes/optimize-instructions-eh.wast +++ b/test/lit/passes/optimize-instructions-eh.wast @@ -4,6 +4,7 @@ (module ;; CHECK: (tag $e (param i32)) + ;; CHECK: (func $dummy ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/optimize-instructions-gc.wast b/test/lit/passes/optimize-instructions-gc.wast index 3f8c21bfc..9e4ec450c 100644 --- a/test/lit/passes/optimize-instructions-gc.wast +++ b/test/lit/passes/optimize-instructions-gc.wast @@ -4,7 +4,9 @@ (module ;; CHECK: (type $struct (struct (field $i8 (mut i8)) (field $i16 (mut i16)) (field $i32 (mut i32)) (field $i64 (mut i64)))) + ;; CHECK: (type $array (array (mut i8))) + ;; CHECK: (import "env" "get-i32" (func $get-i32 (result i32))) (import "env" "get-i32" (func $get-i32 (result i32))) diff --git a/test/lit/passes/poppify-globals.wast b/test/lit/passes/poppify-globals.wast index ccdb025c0..869015cb7 100644 --- a/test/lit/passes/poppify-globals.wast +++ b/test/lit/passes/poppify-globals.wast @@ -1,26 +1,37 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. ;; TODO: enable validation ;; RUN: wasm-opt %s --poppify --no-validation -all -S -o - | filecheck %s (module - ;; CHECK: (global $foo (mut i32) (i32.const 0)) + ;; CHECK: (type $none_=>_i32_i64_f32 (func (result i32 i64 f32))) + + ;; CHECK: (type $none_=>_none (func)) + + ;; CHECK: (global $foo (mut i32) (i32.const 0)) (global $foo (mut i32) (i32.const 0)) - ;; CHECK: (global $tuple$1 f64 (f64.const 0)) + ;; CHECK: (global $tuple$1 f64 (f64.const 0)) (global $tuple$1 f64 (f64.const 0)) ;; interfering name! - ;; CHECK: (global $tuple$2 (mut f32) (f32.const 2)) - ;; CHECK: (global $tuple$1_0 (mut i64) (i64.const 1)) - ;; CHECK: (global $tuple$0 (mut i32) (global.get $foo)) (global $tuple (mut (i32 i64 f32)) (tuple.make (global.get $foo) (i64.const 1) (f32.const 2)) ) - ;; CHECK: (global $other-tuple$2 f32 (global.get $tuple$2)) - ;; CHECK: (global $other-tuple$1 i64 (global.get $tuple$1_0)) - ;; CHECK: (global $other-tuple$0 i32 (global.get $tuple$0)) (global $other-tuple (i32 i64 f32) (global.get $tuple)) - ;; CHECK: (func $global-get-tuple + ;; CHECK: (global $tuple$2 (mut f32) (f32.const 2)) + + ;; CHECK: (global $tuple$1_0 (mut i64) (i64.const 1)) + + ;; CHECK: (global $tuple$0 (mut i32) (global.get $foo)) + + ;; CHECK: (global $other-tuple$2 f32 (global.get $tuple$2)) + + ;; CHECK: (global $other-tuple$1 i64 (global.get $tuple$1_0)) + + ;; CHECK: (global $other-tuple$0 i32 (global.get $tuple$0)) + + ;; CHECK: (func $global-get-tuple (result i32 i64 f32) ;; CHECK-NEXT: (global.get $tuple$0) ;; CHECK-NEXT: (global.get $tuple$1_0) ;; CHECK-NEXT: (global.get $tuple$2) diff --git a/test/lit/passes/precompute-gc.wast b/test/lit/passes/precompute-gc.wast index b6c526e7b..c27433e98 100644 --- a/test/lit/passes/precompute-gc.wast +++ b/test/lit/passes/precompute-gc.wast @@ -6,7 +6,9 @@ ;; CHECK: (type $struct (struct (field (mut i32)))) (type $struct (struct (mut i32))) ;; CHECK: (type $B (struct (field (mut f64)))) + ;; CHECK: (type $func-return-i32 (func (result i32))) + ;; CHECK: (type $empty (struct )) (type $empty (struct)) diff --git a/test/lit/passes/roundtrip-gc-types.wast b/test/lit/passes/roundtrip-gc-types.wast index 85914fd79..6a96fd915 100644 --- a/test/lit/passes/roundtrip-gc-types.wast +++ b/test/lit/passes/roundtrip-gc-types.wast @@ -10,6 +10,7 @@ ;; CHECK: (type $A (struct (field (ref $C)))) (type $A (struct (field (ref $C)))) ;; CHECK: (type $C (struct (field (mut (ref $B))))) + ;; CHECK: (type $B (func (param (ref $A)) (result (ref $B)))) (type $B (func (param (ref $A)) (result (ref $B)))) (type $C (struct (field (mut (ref $B))))) diff --git a/test/lit/recursive-types.wast b/test/lit/recursive-types.wast index a5d301006..ced89612d 100644 --- a/test/lit/recursive-types.wast +++ b/test/lit/recursive-types.wast @@ -1,25 +1,7 @@ -;; Test a trivial recursive type works properly - -;; RUN: wasm-opt %s -all -S -o - | filecheck %s - -;; CHECK: (module -;; CHECK-NEXT: (type $ref?|...0|_=>_ref?|...0| (func (param (ref null $ref?|...0|_=>_ref?|...0|)) (result (ref null $ref?|...0|_=>_ref?|...0|)))) -;; CHECK-NEXT: (func $foo (param $0 (ref null $ref?|...0|_=>_ref?|...0|)) (result (ref null $ref?|...0|_=>_ref?|...0|)) -;; CHECK-NEXT: (unreachable) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (func $bar (param $0 (ref null $ref?|...0|_=>_ref?|...0|)) (result (ref null $ref?|...0|_=>_ref?|...0|)) -;; CHECK-NEXT: (unreachable) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (func $baz (param $0 (ref null $ref?|...0|_=>_ref?|...0|)) (result (ref null $ref?|...0|_=>_ref?|...0|)) -;; CHECK-NEXT: (unreachable) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (func $qux (param $0 (ref null $ref?|...0|_=>_ref?|...0|)) (result (ref null $ref?|...0|_=>_ref?|...0|)) -;; CHECK-NEXT: (unreachable) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (func $quux (param $0 (ref null $ref?|...0|_=>_ref?|...0|)) (result (ref null $ref?|...0|_=>_ref?|...0|)) -;; CHECK-NEXT: (unreachable) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) +;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. +;; Test that a trivial recursive type works properly + +;; RUN: wasm-opt %s -all --name-types -S -o - | filecheck %s (module (type (func (param (ref null 0)) (result (ref null 0)))) @@ -27,18 +9,40 @@ (type (func (param (ref null 0)) (result (ref null 1)))) (type (func (param (ref null 3)) (result (ref null 4)))) (type (func (param (ref null 4)) (result (ref null 3)))) + + ;; CHECK: (type $type$0 (func (param (ref null $type$0)) (result (ref null $type$0)))) + + ;; CHECK: (func $foo (param $0 (ref null $type$0)) (result (ref null $type$0)) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) (func $foo (type 0) (unreachable) ) + + ;; CHECK: (func $bar (param $0 (ref null $type$0)) (result (ref null $type$0)) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) (func $bar (type 1) (unreachable) ) + + ;; CHECK: (func $baz (param $0 (ref null $type$0)) (result (ref null $type$0)) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) (func $baz (type 2) (unreachable) ) + + ;; CHECK: (func $qux (param $0 (ref null $type$0)) (result (ref null $type$0)) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) (func $qux (type 3) (unreachable) ) + + ;; CHECK: (func $quux (param $0 (ref null $type$0)) (result (ref null $type$0)) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) (func $quux (type 4) (unreachable) ) |