diff options
-rw-r--r-- | test/lit/passes/j2cl-merge-itables.wast | 15 | ||||
-rw-r--r-- | test/lit/passes/string-lowering-instructions.wast | 76 | ||||
-rw-r--r-- | test/lit/passes/type-refining.wast | 62 | ||||
-rw-r--r-- | test/lit/passes/unsubtyping-casts.wast | 3 |
4 files changed, 76 insertions, 80 deletions
diff --git a/test/lit/passes/j2cl-merge-itables.wast b/test/lit/passes/j2cl-merge-itables.wast index f578eb65c..499f598e1 100644 --- a/test/lit/passes/j2cl-merge-itables.wast +++ b/test/lit/passes/j2cl-merge-itables.wast @@ -1,6 +1,7 @@ ;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. -;; RUN: foreach %s %t wasm-opt --closed-world --merge-j2cl-itables -all -S -o - | filecheck %s +;; RUN: foreach %s %t wasm-opt -all --closed-world --preserve-type-order \ +;; RUN: --merge-j2cl-itables -all -S -o - | filecheck %s ;; Shared itable instance. (module @@ -16,8 +17,6 @@ (field $vtable (ref $SubObject.vtable)) (field $itable (ref $Object.itable))))) - ;; CHECK: (type $2 (func)) - ;; CHECK: (type $function (func)) (type $function (func)) @@ -37,6 +36,8 @@ (field (ref null struct)))) ) + ;; CHECK: (type $6 (func)) + ;; CHECK: (global $Object.itable (ref $Object.itable) (struct.new_default $Object.itable)) (global $Object.itable (ref $Object.itable) (struct.new_default $Object.itable)) @@ -70,7 +71,7 @@ (type $function) ) - ;; CHECK: (func $usages (type $2) + ;; CHECK: (func $usages (type $6) ;; CHECK-NEXT: (local $o (ref null $SubObject)) ;; CHECK-NEXT: (local.set $o ;; CHECK-NEXT: (struct.new $SubObject @@ -128,8 +129,6 @@ (field $vtable (ref $SubObject.vtable)) (field $itable (ref $SubObject.itable))))) - ;; CHECK: (type $2 (func)) - ;; CHECK: (type $function (func)) (type $function (func)) @@ -155,6 +154,8 @@ ;; The initialization for the itable field (null struct) will be added to this ;; vtable instance. + ;; CHECK: (type $7 (func)) + ;; CHECK: (global $SubObject.vtable (ref $SubObject.vtable) (struct.new $SubObject.vtable ;; CHECK-NEXT: (ref.null none) ;; CHECK-NEXT: (ref.func $SubObject.f) @@ -185,7 +186,7 @@ (type $function) ) - ;; CHECK: (func $usages (type $2) + ;; CHECK: (func $usages (type $7) ;; CHECK-NEXT: (local $o (ref null $SubObject)) ;; CHECK-NEXT: (local.set $o ;; CHECK-NEXT: (struct.new $SubObject diff --git a/test/lit/passes/string-lowering-instructions.wast b/test/lit/passes/string-lowering-instructions.wast index 459f18170..d8ba996b2 100644 --- a/test/lit/passes/string-lowering-instructions.wast +++ b/test/lit/passes/string-lowering-instructions.wast @@ -1,24 +1,18 @@ ;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. -;; RUN: foreach %s %t wasm-opt --string-lowering -all -S -o - | filecheck %s +;; RUN: foreach %s %t wasm-opt -all --preserve-type-order --string-lowering -S -o - | filecheck %s (module (rec - ;; CHECK: (type $0 (array (mut i16))) + ;; CHECK: (type $0 (func)) - ;; CHECK: (type $1 (func)) - - ;; CHECK: (type $2 (func (result externref))) - - ;; CHECK: (type $3 (func (param externref externref) (result i32))) + ;; CHECK: (type $1 (array (mut i16))) ;; CHECK: (rec - ;; CHECK-NEXT: (type $4 (func (param externref))) - - ;; CHECK: (type $struct-of-string (struct (field externref) (field i32) (field anyref))) + ;; CHECK-NEXT: (type $struct-of-string (struct (field externref) (field i32) (field anyref))) (type $struct-of-string (struct (field stringref) (field i32) (field anyref))) - ;; CHECK: (type $struct-of-array (struct (field (ref $0)))) + ;; CHECK: (type $struct-of-array (struct (field (ref $1)))) (type $struct-of-array (struct (field (ref $array16)))) ;; CHECK: (type $array16-imm (array i32)) @@ -37,27 +31,33 @@ (type $array16 (array (mut i16))) ) - ;; CHECK: (type $12 (func (param externref) (result externref))) + ;; CHECK: (type $9 (func (param (ref $1)))) + + ;; CHECK: (type $10 (func (param externref externref) (result (ref extern)))) + + ;; CHECK: (type $11 (func (param externref (ref $1)) (result i32))) + + ;; CHECK: (type $12 (func (param externref externref) (result i32))) ;; CHECK: (type $13 (func (param externref) (result i32))) - ;; CHECK: (type $14 (func (param externref externref) (result i32))) + ;; CHECK: (type $14 (func (param externref) (result externref))) - ;; CHECK: (type $15 (func (param externref (ref $0)) (result i32))) + ;; CHECK: (type $15 (func (param externref))) - ;; CHECK: (type $16 (func (param externref externref) (result (ref extern)))) + ;; CHECK: (type $16 (func (result externref))) - ;; CHECK: (type $17 (func (param (ref $0)))) + ;; CHECK: (type $17 (func (param externref externref) (result i32))) ;; CHECK: (type $18 (func (param externref i32 externref))) - ;; CHECK: (type $19 (func (param (ref null $0) i32 i32) (result (ref extern)))) + ;; CHECK: (type $19 (func (param (ref null $1) i32 i32) (result (ref extern)))) ;; CHECK: (type $20 (func (param i32) (result (ref extern)))) ;; CHECK: (type $21 (func (param externref externref) (result (ref extern)))) - ;; CHECK: (type $22 (func (param externref (ref null $0) i32) (result i32))) + ;; CHECK: (type $22 (func (param externref (ref null $1) i32) (result i32))) ;; CHECK: (type $23 (func (param externref) (result i32))) @@ -69,21 +69,21 @@ ;; CHECK: (import "string.const" "1" (global $string.const_value (ref extern))) - ;; CHECK: (import "colliding" "name" (func $fromCodePoint (type $1))) + ;; CHECK: (import "colliding" "name" (func $fromCodePoint (type $0))) (import "colliding" "name" (func $fromCodePoint)) - ;; CHECK: (import "wasm:js-string" "fromCharCodeArray" (func $fromCharCodeArray (type $19) (param (ref null $0) i32 i32) (result (ref extern)))) + ;; CHECK: (import "wasm:js-string" "fromCharCodeArray" (func $fromCharCodeArray (type $19) (param (ref null $1) i32 i32) (result (ref extern)))) ;; CHECK: (import "wasm:js-string" "fromCodePoint" (func $fromCodePoint_18 (type $20) (param i32) (result (ref extern)))) ;; CHECK: (import "wasm:js-string" "concat" (func $concat (type $21) (param externref externref) (result (ref extern)))) - ;; CHECK: (import "wasm:js-string" "intoCharCodeArray" (func $intoCharCodeArray (type $22) (param externref (ref null $0) i32) (result i32))) + ;; CHECK: (import "wasm:js-string" "intoCharCodeArray" (func $intoCharCodeArray (type $22) (param externref (ref null $1) i32) (result i32))) - ;; CHECK: (import "wasm:js-string" "equals" (func $equals (type $3) (param externref externref) (result i32))) + ;; CHECK: (import "wasm:js-string" "equals" (func $equals (type $17) (param externref externref) (result i32))) - ;; CHECK: (import "wasm:js-string" "compare" (func $compare (type $3) (param externref externref) (result i32))) + ;; CHECK: (import "wasm:js-string" "compare" (func $compare (type $17) (param externref externref) (result i32))) ;; CHECK: (import "wasm:js-string" "length" (func $length (type $23) (param externref) (result i32))) @@ -98,7 +98,7 @@ ;; CHECK: (export "export.2" (func $exported-string-receiver)) - ;; CHECK: (func $string.new.gc (type $17) (param $array16 (ref $0)) + ;; CHECK: (func $string.new.gc (type $9) (param $array16 (ref $1)) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (call $fromCharCodeArray ;; CHECK-NEXT: (local.get $array16) @@ -117,7 +117,7 @@ ) ) - ;; CHECK: (func $string.from_code_point (type $2) (result externref) + ;; CHECK: (func $string.from_code_point (type $16) (result externref) ;; CHECK-NEXT: (call $fromCodePoint_18 ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) @@ -128,7 +128,7 @@ ) ) - ;; CHECK: (func $string.concat (type $16) (param $0 externref) (param $1 externref) (result (ref extern)) + ;; CHECK: (func $string.concat (type $10) (param $0 externref) (param $1 externref) (result (ref extern)) ;; CHECK-NEXT: (call $concat ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: (local.get $1) @@ -141,7 +141,7 @@ ) ) - ;; CHECK: (func $string.encode (type $15) (param $ref externref) (param $array16 (ref $0)) (result i32) + ;; CHECK: (func $string.encode (type $11) (param $ref externref) (param $array16 (ref $1)) (result i32) ;; CHECK-NEXT: (call $intoCharCodeArray ;; CHECK-NEXT: (local.get $ref) ;; CHECK-NEXT: (local.get $array16) @@ -156,7 +156,7 @@ ) ) - ;; CHECK: (func $string.eq (type $14) (param $a externref) (param $b externref) (result i32) + ;; CHECK: (func $string.eq (type $12) (param $a externref) (param $b externref) (result i32) ;; CHECK-NEXT: (call $equals ;; CHECK-NEXT: (local.get $a) ;; CHECK-NEXT: (local.get $b) @@ -169,7 +169,7 @@ ) ) - ;; CHECK: (func $string.compare (type $14) (param $a externref) (param $b externref) (result i32) + ;; CHECK: (func $string.compare (type $12) (param $a externref) (param $b externref) (result i32) ;; CHECK-NEXT: (call $compare ;; CHECK-NEXT: (local.get $a) ;; CHECK-NEXT: (local.get $b) @@ -206,7 +206,7 @@ ) ) - ;; CHECK: (func $string.slice (type $12) (param $ref externref) (result externref) + ;; CHECK: (func $string.slice (type $14) (param $ref externref) (result externref) ;; CHECK-NEXT: (call $substring ;; CHECK-NEXT: (local.get $ref) ;; CHECK-NEXT: (i32.const 2) @@ -221,7 +221,7 @@ ) ) - ;; CHECK: (func $if.string (type $12) (param $ref externref) (result externref) + ;; CHECK: (func $if.string (type $14) (param $ref externref) (result externref) ;; CHECK-NEXT: (if (result externref) ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: (then @@ -244,7 +244,7 @@ ) ) - ;; CHECK: (func $if.string.flip (type $12) (param $ref externref) (result externref) + ;; CHECK: (func $if.string.flip (type $14) (param $ref externref) (result externref) ;; CHECK-NEXT: (if (result externref) ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: (then @@ -268,7 +268,7 @@ ) ) - ;; CHECK: (func $exported-string-returner (type $2) (result externref) + ;; CHECK: (func $exported-string-returner (type $16) (result externref) ;; CHECK-NEXT: (global.get $string.const_exported) ;; CHECK-NEXT: ) (func $exported-string-returner (export "export.1") (result stringref) @@ -302,8 +302,8 @@ ) ) - ;; CHECK: (func $use-struct-of-array (type $1) - ;; CHECK-NEXT: (local $array16 (ref $0)) + ;; CHECK: (func $use-struct-of-array (type $0) + ;; CHECK-NEXT: (local $array16 (ref $1)) ;; CHECK-NEXT: (local $open (ref $array16-open)) ;; CHECK-NEXT: (local $child (ref $array16-child)) ;; CHECK-NEXT: (local $32 (ref $array32)) @@ -312,7 +312,7 @@ ;; CHECK-NEXT: (call $fromCharCodeArray ;; CHECK-NEXT: (struct.get $struct-of-array 0 ;; CHECK-NEXT: (struct.new $struct-of-array - ;; CHECK-NEXT: (array.new_fixed $0 2 + ;; CHECK-NEXT: (array.new_fixed $1 2 ;; CHECK-NEXT: (i32.const 10) ;; CHECK-NEXT: (i32.const 20) ;; CHECK-NEXT: ) @@ -358,7 +358,7 @@ ) ) - ;; CHECK: (func $struct-of-string (type $1) + ;; CHECK: (func $struct-of-string (type $0) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (struct.new $struct-of-string ;; CHECK-NEXT: (ref.null noextern) @@ -398,7 +398,7 @@ ) ) - ;; CHECK: (func $call-param-null (type $4) (param $str externref) + ;; CHECK: (func $call-param-null (type $15) (param $str externref) ;; CHECK-NEXT: (call $call-param-null ;; CHECK-NEXT: (ref.null noextern) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/type-refining.wast b/test/lit/passes/type-refining.wast index ab82aeb36..5689ff3dc 100644 --- a/test/lit/passes/type-refining.wast +++ b/test/lit/passes/type-refining.wast @@ -1,5 +1,6 @@ ;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. -;; RUN: foreach %s %t wasm-opt --closed-world --type-refining -all -S -o - | filecheck %s +;; RUN: foreach %s %t wasm-opt -all --closed-world --preserve-type-order \ +;; RUN: --type-refining -S -o - | filecheck %s (module ;; A struct with three fields. The first will have no writes, the second one @@ -93,11 +94,10 @@ ;; CHECK-NEXT: (type $struct (sub (struct (field (mut (ref $struct)))))) (type $struct (sub (struct (field (mut structref))))) - ;; CHECK: (type $child-B (sub $struct (struct (field (mut (ref $struct)))))) - ;; CHECK: (type $child-A (sub $struct (struct (field (mut (ref $struct)))))) (type $child-A (sub $struct (struct (field (mut structref))))) + ;; CHECK: (type $child-B (sub $struct (struct (field (mut (ref $struct)))))) (type $child-B (sub $struct (struct (field (mut structref))))) ) @@ -141,11 +141,11 @@ (type $child-B (sub $struct (struct (field (mut structref))))) ) - ;; CHECK: (type $3 (func)) + ;; CHECK: (type $3 (func (param (ref $struct) (ref $child-A)))) - ;; CHECK: (type $4 (func (param (ref $struct) (ref $child-A)))) + ;; CHECK: (type $4 (func)) - ;; CHECK: (func $work (type $4) (param $struct (ref $struct)) (param $child-A (ref $child-A)) + ;; CHECK: (func $work (type $3) (param $struct (ref $struct)) (param $child-A (ref $child-A)) ;; CHECK-NEXT: (struct.set $struct 0 ;; CHECK-NEXT: (local.get $struct) ;; CHECK-NEXT: (local.get $child-A) @@ -166,7 +166,7 @@ ) ) - ;; CHECK: (func $keepalive (type $3) + ;; CHECK: (func $keepalive (type $4) ;; CHECK-NEXT: (local $temp (ref null $child-B)) ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) @@ -455,21 +455,19 @@ (module (rec ;; CHECK: (rec - ;; CHECK-NEXT: (type $A (sub (struct (field (ref $Y))))) - - ;; CHECK: (type $B (sub $A (struct (field (ref $Y))))) - - ;; CHECK: (type $X (sub (struct))) + ;; CHECK-NEXT: (type $X (sub (struct))) (type $X (sub (struct))) ;; CHECK: (type $Y (sub $X (struct))) (type $Y (sub $X (struct))) + ;; CHECK: (type $A (sub (struct (field (ref $Y))))) (type $A (sub (struct (field (ref $X))))) ;; CHECK: (type $C (sub $A (struct (field (ref $Y))))) (type $C (sub $A (struct (field (ref $X))))) + ;; CHECK: (type $B (sub $A (struct (field (ref $Y))))) (type $B (sub $A (struct (field (ref $X))))) ) @@ -545,19 +543,18 @@ ;; CHECK: (type $X (sub (struct))) (type $X (sub (struct))) - ;; CHECK: (type $A (sub (struct (field (ref $X))))) - ;; CHECK: (type $Y (sub $X (struct))) (type $Y (sub $X (struct))) + ;; CHECK: (type $A (sub (struct (field (ref $X))))) (type $A (sub (struct (field (ref $X))))) - ;; CHECK: (type $3 (func)) - ;; CHECK: (type $B (sub $A (struct (field (ref $Y))))) (type $B (sub $A (struct (field (ref $Y))))) - ;; CHECK: (func $foo (type $3) + ;; CHECK: (type $4 (func)) + + ;; CHECK: (func $foo (type $4) ;; CHECK-NEXT: (local $unused2 (ref null $B)) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (struct.new $A @@ -825,19 +822,16 @@ ;; CHECK: (type $Leaf1-Inner (sub $Root-Inner (struct (field i32)))) (type $Leaf1-Inner (sub $Root-Inner (struct (field i32)))) - ;; CHECK: (type $Root-Outer (sub (struct (field (ref $Leaf2-Inner))))) - - ;; CHECK: (type $Leaf1-Outer (sub $Root-Outer (struct (field (ref $Leaf2-Inner))))) - - ;; CHECK: (type $Leaf2-Outer (sub $Root-Outer (struct (field (ref $Leaf2-Inner))))) - ;; CHECK: (type $Leaf2-Inner (sub $Root-Inner (struct))) (type $Leaf2-Inner (sub $Root-Inner (struct ))) + ;; CHECK: (type $Root-Outer (sub (struct (field (ref $Leaf2-Inner))))) (type $Root-Outer (sub (struct (field (ref $Root-Inner))))) + ;; CHECK: (type $Leaf1-Outer (sub $Root-Outer (struct (field (ref $Leaf2-Inner))))) (type $Leaf1-Outer (sub $Root-Outer (struct (field (ref $Leaf1-Inner))))) + ;; CHECK: (type $Leaf2-Outer (sub $Root-Outer (struct (field (ref $Leaf2-Inner))))) (type $Leaf2-Outer (sub $Root-Outer (struct (field (ref $Leaf2-Inner))))) ;; CHECK: (type $6 (func (param (ref null $Leaf1-Outer)))) @@ -1241,25 +1235,25 @@ (module ;; CHECK: (rec - ;; CHECK-NEXT: (type $0 (func (param (ref noextern)))) + ;; CHECK-NEXT: (type $A (struct (field (mut (ref noextern))))) + (type $A (struct (field (mut externref)))) - ;; CHECK: (type $1 (func (param (ref none) (ref noextern)))) + ;; CHECK: (type $1 (func)) - ;; CHECK: (type $2 (func (param (ref $A) externref))) + ;; CHECK: (type $2 (func (param externref) (result anyref))) - ;; CHECK: (type $A (struct (field (mut (ref noextern))))) - (type $A (struct (field (mut externref)))) + ;; CHECK: (type $3 (func (param (ref $A) externref))) - ;; CHECK: (type $4 (func (param externref) (result anyref))) + ;; CHECK: (type $4 (func (param (ref none) (ref noextern)))) - ;; CHECK: (type $5 (func)) + ;; CHECK: (type $5 (func (param (ref noextern)))) ;; CHECK: (type $6 (func)) ;; CHECK: (tag $tag) (tag $tag) - ;; CHECK: (func $struct.new (type $4) (param $extern externref) (result anyref) + ;; CHECK: (func $struct.new (type $2) (param $extern externref) (result anyref) ;; CHECK-NEXT: (struct.new $A ;; CHECK-NEXT: (ref.cast (ref noextern) ;; CHECK-NEXT: (try (result externref) @@ -1310,7 +1304,7 @@ ) ) - ;; CHECK: (func $struct.set (type $2) (param $ref (ref $A)) (param $extern externref) + ;; CHECK: (func $struct.set (type $3) (param $ref (ref $A)) (param $extern externref) ;; CHECK-NEXT: (struct.set $A 0 ;; CHECK-NEXT: (local.get $ref) ;; CHECK-NEXT: (ref.cast (ref noextern) @@ -1351,7 +1345,7 @@ ) ) - ;; CHECK: (func $bottom.type (type $1) (param $ref (ref none)) (param $value (ref noextern)) + ;; CHECK: (func $bottom.type (type $4) (param $ref (ref none)) (param $value (ref noextern)) ;; CHECK-NEXT: (block ;; (replaces unreachable StructSet we can't emit) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (local.get $ref) @@ -1370,7 +1364,7 @@ ) ) - ;; CHECK: (func $unreachable (type $0) (param $value (ref noextern)) + ;; CHECK: (func $unreachable (type $5) (param $value (ref noextern)) ;; CHECK-NEXT: (block ;; (replaces unreachable StructSet we can't emit) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (unreachable) diff --git a/test/lit/passes/unsubtyping-casts.wast b/test/lit/passes/unsubtyping-casts.wast index 95394bdd0..9852fe470 100644 --- a/test/lit/passes/unsubtyping-casts.wast +++ b/test/lit/passes/unsubtyping-casts.wast @@ -1,5 +1,6 @@ ;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. -;; RUN: foreach %s %t wasm-opt --closed-world --unsubtyping --remove-unused-types -all -S -o - | filecheck %s +;; RUN: foreach %s %t wasm-opt -all --closed-world --preserve-type-order \ +;; RUN: --unsubtyping --remove-unused-types -S -o - | filecheck %s (module ;; CHECK: (rec |