diff options
author | Thomas Lively <tlively@google.com> | 2024-09-10 12:01:22 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-10 12:01:22 -0700 |
commit | 801518be793b0fc6ff8043cfdf64e4fd6c6813cd (patch) | |
tree | 7c4cb9751a5e080794c8ee9e077b543f876a784a /test | |
parent | b4a34d20c957404206875242781e61dc84a1cd28 (diff) | |
download | binaryen-801518be793b0fc6ff8043cfdf64e4fd6c6813cd.tar.gz binaryen-801518be793b0fc6ff8043cfdf64e4fd6c6813cd.tar.bz2 binaryen-801518be793b0fc6ff8043cfdf64e4fd6c6813cd.zip |
Use --preserve-type-order in select tests (#6917)
These are the tests that would otherwise have the largest diffs when
changing the topological sort used to sort types.
signature-refining_gto.wat also cannot be automatically updated, so
there is extra benefit to making sure it has stable output.
Diffstat (limited to 'test')
-rw-r--r-- | test/lit/passes/abstract-type-refining.wast | 148 | ||||
-rw-r--r-- | test/lit/passes/signature-refining_gto.wat | 11 | ||||
-rw-r--r-- | test/lit/passes/type-merging.wast | 126 | ||||
-rw-r--r-- | test/lit/passes/unsubtyping.wast | 116 |
4 files changed, 177 insertions, 224 deletions
diff --git a/test/lit/passes/abstract-type-refining.wast b/test/lit/passes/abstract-type-refining.wast index c0a2f12b3..814f5c1f0 100644 --- a/test/lit/passes/abstract-type-refining.wast +++ b/test/lit/passes/abstract-type-refining.wast @@ -1,7 +1,9 @@ ;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. -;; RUN: foreach %s %t wasm-opt --abstract-type-refining --remove-unused-types --traps-never-happen -all --closed-world -S -o - | filecheck %s --check-prefix=YESTNH -;; RUN: foreach %s %t wasm-opt --abstract-type-refining --remove-unused-types -all --closed-world -S -o - | filecheck %s --check-prefix=NO_TNH +;; RUN: foreach %s %t wasm-opt --abstract-type-refining --remove-unused-types --traps-never-happen \ +;; RUN: -all --closed-world --preserve-type-order -S -o - | filecheck %s --check-prefix=YESTNH +;; RUN: foreach %s %t wasm-opt --abstract-type-refining --remove-unused-types \ +;; RUN: -all --closed-world --preserve-type-order -S -o - | filecheck %s --check-prefix=NO_TNH ;; Run in both TNH and non-TNH mode. @@ -12,15 +14,11 @@ ;; TNH mode $A and $D will also not be emitted in the output anymore. (module ;; NO_TNH: (rec - ;; NO_TNH-NEXT: (type $0 (func)) - - ;; NO_TNH: (type $A (sub (struct))) + ;; NO_TNH-NEXT: (type $A (sub (struct))) (type $A (sub (struct))) ;; YESTNH: (rec - ;; YESTNH-NEXT: (type $0 (func)) - - ;; YESTNH: (type $B (sub (struct))) + ;; YESTNH-NEXT: (type $B (sub (struct))) ;; NO_TNH: (type $B (sub $A (struct))) (type $B (sub $A (struct))) @@ -35,15 +33,19 @@ ;; NO_TNH: (type $E (sub $D (struct))) (type $E (sub $D (struct))) - ;; YESTNH: (type $4 (func (param anyref))) + ;; YESTNH: (type $3 (func (param anyref))) + + ;; YESTNH: (type $4 (func)) ;; YESTNH: (global $global anyref (struct.new_default $B)) - ;; NO_TNH: (type $6 (func (param anyref))) + ;; NO_TNH: (type $5 (func (param anyref))) + + ;; NO_TNH: (type $6 (func)) ;; NO_TNH: (global $global anyref (struct.new_default $B)) (global $global anyref (struct.new $B)) - ;; YESTNH: (func $new (type $4) (param $x anyref) + ;; YESTNH: (func $new (type $3) (param $x anyref) ;; YESTNH-NEXT: (drop ;; YESTNH-NEXT: (struct.new_default $C) ;; YESTNH-NEXT: ) @@ -51,7 +53,7 @@ ;; YESTNH-NEXT: (struct.new_default $E) ;; YESTNH-NEXT: ) ;; YESTNH-NEXT: ) - ;; NO_TNH: (func $new (type $6) (param $x anyref) + ;; NO_TNH: (func $new (type $5) (param $x anyref) ;; NO_TNH-NEXT: (drop ;; NO_TNH-NEXT: (struct.new_default $C) ;; NO_TNH-NEXT: ) @@ -68,7 +70,7 @@ ) ) - ;; YESTNH: (func $ref.cast (type $4) (param $x anyref) + ;; YESTNH: (func $ref.cast (type $3) (param $x anyref) ;; YESTNH-NEXT: (drop ;; YESTNH-NEXT: (ref.cast (ref $B) ;; YESTNH-NEXT: (local.get $x) @@ -95,7 +97,7 @@ ;; YESTNH-NEXT: ) ;; YESTNH-NEXT: ) ;; YESTNH-NEXT: ) - ;; NO_TNH: (func $ref.cast (type $6) (param $x anyref) + ;; NO_TNH: (func $ref.cast (type $5) (param $x anyref) ;; NO_TNH-NEXT: (drop ;; NO_TNH-NEXT: (ref.cast (ref $A) ;; NO_TNH-NEXT: (local.get $x) @@ -152,14 +154,14 @@ ) ) - ;; YESTNH: (func $ref.test (type $4) (param $x anyref) + ;; YESTNH: (func $ref.test (type $3) (param $x anyref) ;; YESTNH-NEXT: (drop ;; YESTNH-NEXT: (ref.test (ref $B) ;; YESTNH-NEXT: (local.get $x) ;; YESTNH-NEXT: ) ;; YESTNH-NEXT: ) ;; YESTNH-NEXT: ) - ;; NO_TNH: (func $ref.test (type $6) (param $x anyref) + ;; NO_TNH: (func $ref.test (type $5) (param $x anyref) ;; NO_TNH-NEXT: (drop ;; NO_TNH-NEXT: (ref.test (ref $A) ;; NO_TNH-NEXT: (local.get $x) @@ -174,7 +176,7 @@ ) ) - ;; YESTNH: (func $br_on (type $4) (param $x anyref) + ;; YESTNH: (func $br_on (type $3) (param $x anyref) ;; YESTNH-NEXT: (drop ;; YESTNH-NEXT: (block $block (result (ref $B)) ;; YESTNH-NEXT: (drop @@ -186,7 +188,7 @@ ;; YESTNH-NEXT: ) ;; YESTNH-NEXT: ) ;; YESTNH-NEXT: ) - ;; NO_TNH: (func $br_on (type $6) (param $x anyref) + ;; NO_TNH: (func $br_on (type $5) (param $x anyref) ;; NO_TNH-NEXT: (drop ;; NO_TNH-NEXT: (block $block (result anyref) ;; NO_TNH-NEXT: (drop @@ -211,14 +213,14 @@ ) ) - ;; YESTNH: (func $basic (type $4) (param $x anyref) + ;; YESTNH: (func $basic (type $3) (param $x anyref) ;; YESTNH-NEXT: (drop ;; YESTNH-NEXT: (ref.cast (ref struct) ;; YESTNH-NEXT: (local.get $x) ;; YESTNH-NEXT: ) ;; YESTNH-NEXT: ) ;; YESTNH-NEXT: ) - ;; NO_TNH: (func $basic (type $6) (param $x anyref) + ;; NO_TNH: (func $basic (type $5) (param $x anyref) ;; NO_TNH-NEXT: (drop ;; NO_TNH-NEXT: (ref.cast (ref struct) ;; NO_TNH-NEXT: (local.get $x) @@ -234,7 +236,7 @@ ) ) - ;; YESTNH: (func $locals (type $0) + ;; YESTNH: (func $locals (type $4) ;; YESTNH-NEXT: (local $A (ref $B)) ;; YESTNH-NEXT: (local $B (ref $B)) ;; YESTNH-NEXT: (local $C (ref $C)) @@ -242,7 +244,7 @@ ;; YESTNH-NEXT: (local $E (ref $E)) ;; YESTNH-NEXT: (nop) ;; YESTNH-NEXT: ) - ;; NO_TNH: (func $locals (type $0) + ;; NO_TNH: (func $locals (type $6) ;; NO_TNH-NEXT: (local $A (ref $A)) ;; NO_TNH-NEXT: (local $B (ref $B)) ;; NO_TNH-NEXT: (local $C (ref $C)) @@ -269,31 +271,29 @@ ;; NO_TNH-NEXT: (type $A (sub (struct))) (type $A (sub (struct))) - ;; YESTNH: (type $B1 (sub $A (struct))) - - ;; YESTNH: (type $2 (func (param anyref))) - ;; YESTNH: (type $B (sub $A (struct))) - ;; NO_TNH: (type $B1 (sub $A (struct))) - - ;; NO_TNH: (type $2 (func (param anyref))) - ;; NO_TNH: (type $B (sub $A (struct))) (type $B (sub $A (struct))) + ;; YESTNH: (type $B1 (sub $A (struct))) + ;; NO_TNH: (type $B1 (sub $A (struct))) (type $B1 (sub $A (struct))) ;; this is a new type ) + ;; YESTNH: (type $3 (func (param anyref))) + ;; YESTNH: (global $global anyref (struct.new_default $B)) + ;; NO_TNH: (type $3 (func (param anyref))) + ;; NO_TNH: (global $global anyref (struct.new_default $B)) (global $global anyref (struct.new $B)) - ;; YESTNH: (func $new (type $2) (param $x anyref) + ;; YESTNH: (func $new (type $3) (param $x anyref) ;; YESTNH-NEXT: (drop ;; YESTNH-NEXT: (struct.new_default $B1) ;; YESTNH-NEXT: ) ;; YESTNH-NEXT: ) - ;; NO_TNH: (func $new (type $2) (param $x anyref) + ;; NO_TNH: (func $new (type $3) (param $x anyref) ;; NO_TNH-NEXT: (drop ;; NO_TNH-NEXT: (struct.new_default $B1) ;; NO_TNH-NEXT: ) @@ -304,7 +304,7 @@ ) ) - ;; YESTNH: (func $ref.cast (type $2) (param $x anyref) + ;; YESTNH: (func $ref.cast (type $3) (param $x anyref) ;; YESTNH-NEXT: (drop ;; YESTNH-NEXT: (ref.cast (ref $A) ;; YESTNH-NEXT: (local.get $x) @@ -321,7 +321,7 @@ ;; YESTNH-NEXT: ) ;; YESTNH-NEXT: ) ;; YESTNH-NEXT: ) - ;; NO_TNH: (func $ref.cast (type $2) (param $x anyref) + ;; NO_TNH: (func $ref.cast (type $3) (param $x anyref) ;; NO_TNH-NEXT: (drop ;; NO_TNH-NEXT: (ref.cast (ref $A) ;; NO_TNH-NEXT: (local.get $x) @@ -547,11 +547,11 @@ ) ;; YESTNH: (rec - ;; YESTNH-NEXT: (type $0 (func)) + ;; YESTNH-NEXT: (type $0 (func (param anyref))) - ;; YESTNH: (type $1 (func (param anyref))) + ;; YESTNH: (type $1 (func)) - ;; YESTNH: (func $ref.cast (type $1) (param $x anyref) + ;; YESTNH: (func $ref.cast (type $0) (param $x anyref) ;; YESTNH-NEXT: (drop ;; YESTNH-NEXT: (ref.cast (ref none) ;; YESTNH-NEXT: (local.get $x) @@ -574,11 +574,11 @@ ;; YESTNH-NEXT: ) ;; YESTNH-NEXT: ) ;; NO_TNH: (rec - ;; NO_TNH-NEXT: (type $0 (func)) + ;; NO_TNH-NEXT: (type $0 (func (param anyref))) - ;; NO_TNH: (type $1 (func (param anyref))) + ;; NO_TNH: (type $1 (func)) - ;; NO_TNH: (func $ref.cast (type $1) (param $x anyref) + ;; NO_TNH: (func $ref.cast (type $0) (param $x anyref) ;; NO_TNH-NEXT: (drop ;; NO_TNH-NEXT: (ref.cast (ref none) ;; NO_TNH-NEXT: (local.get $x) @@ -624,7 +624,7 @@ ) ) - ;; YESTNH: (func $ref.cast.null (type $1) (param $x anyref) + ;; YESTNH: (func $ref.cast.null (type $0) (param $x anyref) ;; YESTNH-NEXT: (drop ;; YESTNH-NEXT: (ref.cast nullref ;; YESTNH-NEXT: (local.get $x) @@ -646,7 +646,7 @@ ;; YESTNH-NEXT: ) ;; YESTNH-NEXT: ) ;; YESTNH-NEXT: ) - ;; NO_TNH: (func $ref.cast.null (type $1) (param $x anyref) + ;; NO_TNH: (func $ref.cast.null (type $0) (param $x anyref) ;; NO_TNH-NEXT: (drop ;; NO_TNH-NEXT: (ref.cast nullref ;; NO_TNH-NEXT: (local.get $x) @@ -692,7 +692,7 @@ ) ) - ;; YESTNH: (func $ref.test (type $1) (param $x anyref) + ;; YESTNH: (func $ref.test (type $0) (param $x anyref) ;; YESTNH-NEXT: (drop ;; YESTNH-NEXT: (ref.test (ref none) ;; YESTNH-NEXT: (local.get $x) @@ -704,7 +704,7 @@ ;; YESTNH-NEXT: ) ;; YESTNH-NEXT: ) ;; YESTNH-NEXT: ) - ;; NO_TNH: (func $ref.test (type $1) (param $x anyref) + ;; NO_TNH: (func $ref.test (type $0) (param $x anyref) ;; NO_TNH-NEXT: (drop ;; NO_TNH-NEXT: (ref.test (ref none) ;; NO_TNH-NEXT: (local.get $x) @@ -731,7 +731,7 @@ ) ) - ;; YESTNH: (func $br_on (type $1) (param $x anyref) + ;; YESTNH: (func $br_on (type $0) (param $x anyref) ;; YESTNH-NEXT: (drop ;; YESTNH-NEXT: (block $block (result (ref none)) ;; YESTNH-NEXT: (drop @@ -751,7 +751,7 @@ ;; YESTNH-NEXT: ) ;; YESTNH-NEXT: ) ;; YESTNH-NEXT: ) - ;; NO_TNH: (func $br_on (type $1) (param $x anyref) + ;; NO_TNH: (func $br_on (type $0) (param $x anyref) ;; NO_TNH-NEXT: (drop ;; NO_TNH-NEXT: (block $block (result (ref none)) ;; NO_TNH-NEXT: (drop @@ -794,14 +794,14 @@ ) ) - ;; YESTNH: (func $locals (type $0) + ;; YESTNH: (func $locals (type $1) ;; YESTNH-NEXT: (local $A (ref none)) ;; YESTNH-NEXT: (local $B (ref none)) ;; YESTNH-NEXT: (local $C1 (ref none)) ;; YESTNH-NEXT: (local $C2 nullref) ;; YESTNH-NEXT: (nop) ;; YESTNH-NEXT: ) - ;; NO_TNH: (func $locals (type $0) + ;; NO_TNH: (func $locals (type $1) ;; NO_TNH-NEXT: (local $A (ref none)) ;; NO_TNH-NEXT: (local $B (ref none)) ;; NO_TNH-NEXT: (local $C1 (ref none)) @@ -822,29 +822,29 @@ (module (rec ;; NO_TNH: (rec - ;; NO_TNH-NEXT: (type $0 (func (param anyref))) - - ;; NO_TNH: (type $A (sub (struct))) + ;; NO_TNH-NEXT: (type $A (sub (struct))) (type $A (sub (struct))) ;; NO_TNH: (type $B (sub $A (struct))) (type $B (sub $A (struct))) ;; YESTNH: (rec - ;; YESTNH-NEXT: (type $0 (func (param anyref))) - - ;; YESTNH: (type $C1 (sub (struct))) + ;; YESTNH-NEXT: (type $C1 (sub (struct))) ;; NO_TNH: (type $C1 (sub $B (struct))) (type $C1 (sub $B (struct))) (type $C2 (sub $B (struct))) ) + ;; YESTNH: (type $1 (func (param anyref))) + ;; YESTNH: (global $global anyref (struct.new_default $C1)) + ;; NO_TNH: (type $3 (func (param anyref))) + ;; NO_TNH: (global $global anyref (struct.new_default $C1)) (global $global anyref (struct.new $C1)) - ;; YESTNH: (func $ref.cast (type $0) (param $x anyref) + ;; YESTNH: (func $ref.cast (type $1) (param $x anyref) ;; YESTNH-NEXT: (drop ;; YESTNH-NEXT: (ref.cast (ref $C1) ;; YESTNH-NEXT: (local.get $x) @@ -866,7 +866,7 @@ ;; YESTNH-NEXT: ) ;; YESTNH-NEXT: ) ;; YESTNH-NEXT: ) - ;; NO_TNH: (func $ref.cast (type $0) (param $x anyref) + ;; NO_TNH: (func $ref.cast (type $3) (param $x anyref) ;; NO_TNH-NEXT: (drop ;; NO_TNH-NEXT: (ref.cast (ref $A) ;; NO_TNH-NEXT: (local.get $x) @@ -913,7 +913,7 @@ ) ) - ;; YESTNH: (func $ref.cast.null (type $0) (param $x anyref) + ;; YESTNH: (func $ref.cast.null (type $1) (param $x anyref) ;; YESTNH-NEXT: (drop ;; YESTNH-NEXT: (ref.cast (ref null $C1) ;; YESTNH-NEXT: (local.get $x) @@ -935,7 +935,7 @@ ;; YESTNH-NEXT: ) ;; YESTNH-NEXT: ) ;; YESTNH-NEXT: ) - ;; NO_TNH: (func $ref.cast.null (type $0) (param $x anyref) + ;; NO_TNH: (func $ref.cast.null (type $3) (param $x anyref) ;; NO_TNH-NEXT: (drop ;; NO_TNH-NEXT: (ref.cast (ref null $A) ;; NO_TNH-NEXT: (local.get $x) @@ -1084,19 +1084,17 @@ (type $A (sub (func))) ;; YESTNH: (rec - ;; YESTNH-NEXT: (type $1 (func (param funcref))) - - ;; YESTNH: (type $B (sub $A (func))) + ;; YESTNH-NEXT: (type $B (sub $A (func))) ;; NO_TNH: (rec - ;; NO_TNH-NEXT: (type $1 (func (param funcref))) - - ;; NO_TNH: (type $B (sub $A (func))) + ;; NO_TNH-NEXT: (type $B (sub $A (func))) (type $B (sub $A (func))) ;; YESTNH: (type $C (sub $B (func))) ;; NO_TNH: (type $C (sub $B (func))) (type $C (sub $B (func))) + ;; YESTNH: (type $3 (func (param funcref))) + ;; YESTNH: (elem declare func $A $C) ;; YESTNH: (export "A" (func $A)) @@ -1106,6 +1104,8 @@ ;; YESTNH-NEXT: (ref.func $A) ;; YESTNH-NEXT: ) ;; YESTNH-NEXT: ) + ;; NO_TNH: (type $3 (func (param funcref))) + ;; NO_TNH: (elem declare func $A $C) ;; NO_TNH: (export "A" (func $A)) @@ -1138,7 +1138,7 @@ ) ) - ;; YESTNH: (func $casts (type $1) (param $x funcref) + ;; YESTNH: (func $casts (type $3) (param $x funcref) ;; YESTNH-NEXT: (drop ;; YESTNH-NEXT: (ref.cast (ref $A) ;; YESTNH-NEXT: (local.get $x) @@ -1155,7 +1155,7 @@ ;; YESTNH-NEXT: ) ;; YESTNH-NEXT: ) ;; YESTNH-NEXT: ) - ;; NO_TNH: (func $casts (type $1) (param $x funcref) + ;; NO_TNH: (func $casts (type $3) (param $x funcref) ;; NO_TNH-NEXT: (drop ;; NO_TNH-NEXT: (ref.cast (ref $A) ;; NO_TNH-NEXT: (local.get $x) @@ -1196,13 +1196,9 @@ ;; Array subtyping, which is a TODO - for now we do nothing. (module ;; YESTNH: (rec - ;; YESTNH-NEXT: (type $0 (func (param anyref))) - - ;; YESTNH: (type $A (sub (array (mut i32)))) + ;; YESTNH-NEXT: (type $A (sub (array (mut i32)))) ;; NO_TNH: (rec - ;; NO_TNH-NEXT: (type $0 (func (param anyref))) - - ;; NO_TNH: (type $A (sub (array (mut i32)))) + ;; NO_TNH-NEXT: (type $A (sub (array (mut i32)))) (type $A (sub (array (mut i32)))) ;; YESTNH: (type $B (sub $A (array (mut i32)))) @@ -1213,10 +1209,14 @@ ;; NO_TNH: (type $C (sub $B (array (mut i32)))) (type $C (sub $B (array (mut i32)))) + ;; YESTNH: (type $3 (func (param anyref))) + ;; YESTNH: (global $A (ref $A) (array.new $A ;; YESTNH-NEXT: (i32.const 10) ;; YESTNH-NEXT: (i32.const 20) ;; YESTNH-NEXT: )) + ;; NO_TNH: (type $3 (func (param anyref))) + ;; NO_TNH: (global $A (ref $A) (array.new $A ;; NO_TNH-NEXT: (i32.const 10) ;; NO_TNH-NEXT: (i32.const 20) @@ -1252,7 +1252,7 @@ (i32.const 20) )) - ;; YESTNH: (func $casts (type $0) (param $x anyref) + ;; YESTNH: (func $casts (type $3) (param $x anyref) ;; YESTNH-NEXT: (drop ;; YESTNH-NEXT: (ref.cast (ref $A) ;; YESTNH-NEXT: (local.get $x) @@ -1269,7 +1269,7 @@ ;; YESTNH-NEXT: ) ;; YESTNH-NEXT: ) ;; YESTNH-NEXT: ) - ;; NO_TNH: (func $casts (type $0) (param $x anyref) + ;; NO_TNH: (func $casts (type $3) (param $x anyref) ;; NO_TNH-NEXT: (drop ;; NO_TNH-NEXT: (ref.cast (ref $A) ;; NO_TNH-NEXT: (local.get $x) diff --git a/test/lit/passes/signature-refining_gto.wat b/test/lit/passes/signature-refining_gto.wat index 3876afcbd..ec2b517b1 100644 --- a/test/lit/passes/signature-refining_gto.wat +++ b/test/lit/passes/signature-refining_gto.wat @@ -1,4 +1,5 @@ -;; RUN: wasm-opt %s --closed-world --signature-refining --gto --remove-unused-types --roundtrip -all -S -o - | filecheck %s +;; RUN: wasm-opt %s -all --closed-world --preserve-type-order \ +;; RUN: --signature-refining --gto --remove-unused-types --roundtrip -S -o - | filecheck %s ;; Check that type $A is not included in the final binary after the signature ;; refining optimization and an additional --remove-unused-types pass. @@ -8,11 +9,11 @@ ;; CHECK-NOT: (type $A (type $A (struct (field (mut (ref null $A))))) - ;; CHECK: (type $0 (func (param funcref i32))) + ;; CHECK: (type $0 (func (param (ref none)))) - ;; CHECK: (type $1 (func (param (ref none)))) + ;; CHECK: (type $1 (func (param funcref i32))) - ;; CHECK: (func $struct.get (type $1) (param $0 (ref none)) + ;; CHECK: (func $struct.get (type $0) (param $0 (ref none)) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: ) @@ -31,7 +32,7 @@ ) ) - ;; CHECK: (func $caller (type $0) (param $0 funcref) (param $1 i32) + ;; CHECK: (func $caller (type $1) (param $0 funcref) (param $1 i32) ;; CHECK-NEXT: (call $struct.get ;; CHECK-NEXT: (ref.as_non_null ;; CHECK-NEXT: (ref.null none) diff --git a/test/lit/passes/type-merging.wast b/test/lit/passes/type-merging.wast index fcf3f4332..d6d117a05 100644 --- a/test/lit/passes/type-merging.wast +++ b/test/lit/passes/type-merging.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-merging --remove-unused-types -all -S -o - | filecheck %s +;; RUN: foreach %s %t wasm-opt -all --closed-world --preserve-type-order \ +;; RUN: --type-merging --remove-unused-types -S -o - | filecheck %s (module (rec @@ -7,19 +8,15 @@ ;; CHECK-NEXT: (type $A (sub (struct (field anyref)))) (type $A (sub (struct (field anyref)))) (type $B (sub $A (struct (field anyref)))) - ;; CHECK: (type $G (sub final $A (struct (field anyref)))) - - ;; CHECK: (type $F (sub $A (struct (field anyref)))) - - ;; CHECK: (type $E (sub $A (struct (field eqref)))) - - ;; CHECK: (type $D (sub $A (struct (field (ref any))))) - ;; CHECK: (type $C (sub $A (struct (field anyref) (field f64)))) (type $C (sub $A (struct (field anyref) (field f64)))) + ;; CHECK: (type $D (sub $A (struct (field (ref any))))) (type $D (sub $A (struct (field (ref any))))) + ;; CHECK: (type $E (sub $A (struct (field eqref)))) (type $E (sub $A (struct (field eqref)))) + ;; CHECK: (type $F (sub $A (struct (field anyref)))) (type $F (sub $A (struct (field anyref)))) + ;; CHECK: (type $G (sub final $A (struct (field anyref)))) (type $G (sub final $A (struct (field anyref)))) ) @@ -208,11 +205,10 @@ (module (rec ;; CHECK: (rec - ;; CHECK-NEXT: (type $X (sub (struct (field (ref null $A)) (field f32)))) - - ;; CHECK: (type $A (sub (struct (field (ref null $X)) (field i32)))) + ;; CHECK-NEXT: (type $A (sub (struct (field (ref null $X)) (field i32)))) (type $A (sub (struct (ref null $X) i32))) (type $B (sub $A (struct (ref null $Y) i32))) + ;; CHECK: (type $X (sub (struct (field (ref null $A)) (field f32)))) (type $X (sub (struct (ref null $A) f32))) (type $Y (sub $X (struct (ref null $B) f32))) ) @@ -269,11 +265,10 @@ (rec (type $A (struct (ref null $X) i32)) ;; CHECK: (rec - ;; CHECK-NEXT: (type $Y (struct (field (ref null $B)) (field f32))) - - ;; CHECK: (type $B (struct (field (ref null $Y)) (field i32))) + ;; CHECK-NEXT: (type $B (struct (field (ref null $Y)) (field i32))) (type $B (struct (ref null $Y) i32)) (type $X (struct (ref null $A) f32)) + ;; CHECK: (type $Y (struct (field (ref null $B)) (field f32))) (type $Y (struct (ref null $B) f32)) ) ;; CHECK: (type $2 (func)) @@ -325,11 +320,10 @@ (module (rec ;; CHECK: (rec - ;; CHECK-NEXT: (type $X (sub (struct (field (ref null $A))))) - - ;; CHECK: (type $A (sub (struct (field (ref null $X))))) + ;; CHECK-NEXT: (type $A (sub (struct (field (ref null $X))))) (type $A (sub (struct (ref null $X)))) (type $B (sub $A (struct (ref null $Y)))) + ;; CHECK: (type $X (sub (struct (field (ref null $A))))) (type $X (sub (struct (ref null $A)))) (type $Y (sub $X (struct (ref null $B)))) ) @@ -366,55 +360,43 @@ (module ;; Check that a diversity of root types are merged correctly. ;; CHECK: (rec - ;; CHECK-NEXT: (type $M (struct (field i32) (field i32))) - - ;; CHECK: (type $L (struct (field i32))) - - ;; CHECK: (type $K (func (param i32 i32 i32) (result i32 i32))) - - ;; CHECK: (type $J (func (param i32 i32) (result i32 i32 i32))) - - ;; CHECK: (type $I (array (ref $A))) - - ;; CHECK: (type $H (array (ref null $A))) - - ;; CHECK: (type $G (array (ref any))) - - ;; CHECK: (type $F (array anyref)) - - ;; CHECK: (type $E (array i64)) - - ;; CHECK: (type $D (array i32)) - - ;; CHECK: (type $C (array i16)) - - ;; CHECK: (type $B (array (mut i32))) - - ;; CHECK: (type $A (array i8)) + ;; CHECK-NEXT: (type $A (array i8)) (type $A (array i8)) (type $A' (array i8)) + ;; CHECK: (type $C (array i16)) (type $C (array i16)) (type $C' (array i16)) + ;; CHECK: (type $D (array i32)) (type $D (array i32)) (type $D' (array i32)) + ;; CHECK: (type $B (array (mut i32))) (type $B (array (mut i32))) (type $B' (array (mut i32))) + ;; CHECK: (type $E (array i64)) (type $E (array i64)) (type $E' (array i64)) + ;; CHECK: (type $F (array anyref)) (type $F (array anyref)) (type $F' (array anyref)) + ;; CHECK: (type $G (array (ref any))) (type $G (array (ref any))) (type $G' (array (ref any))) + ;; CHECK: (type $H (array (ref null $A))) (type $H (array (ref null $A))) (type $H' (array (ref null $A))) + ;; CHECK: (type $I (array (ref $A))) (type $I (array (ref $A))) (type $I' (array (ref $A))) + ;; CHECK: (type $J (func (param i32 i32) (result i32 i32 i32))) (type $J (func (param i32 i32) (result i32 i32 i32))) (type $J' (func (param i32 i32) (result i32 i32 i32))) + ;; CHECK: (type $K (func (param i32 i32 i32) (result i32 i32))) (type $K (func (param i32 i32 i32) (result i32 i32))) (type $K' (func (param i32 i32 i32) (result i32 i32))) + ;; CHECK: (type $L (struct (field i32))) (type $L (struct i32)) (type $L' (struct i32)) + ;; CHECK: (type $M (struct (field i32) (field i32))) (type $M (struct i32 i32)) (type $M' (struct i32 i32)) @@ -574,26 +556,23 @@ (rec ;; These will get merged in the initial supertype merging stage. ;; CHECK: (rec - ;; CHECK-NEXT: (type $B' (sub (struct (field (ref $A))))) - - ;; CHECK: (type $C (sub $B' (struct (field (ref $A)) (field i32)))) - - ;; CHECK: (type $D' (sub $C (struct (field (ref $A)) (field i32) (field i32)))) - - ;; CHECK: (type $A (sub (struct))) + ;; CHECK-NEXT: (type $A (sub (struct))) (type $A (sub (struct))) (type $A' (sub $A (struct))) ;; These siblings will be merged only after $a and $a' are merged. (type $B (sub (struct (ref $A)))) + ;; CHECK: (type $B' (sub (struct (field (ref $A))))) (type $B' (sub (struct (ref $A')))) ;; These will get merged only after $b and $b' are merged. + ;; CHECK: (type $C (sub $B' (struct (field (ref $A)) (field i32)))) (type $C (sub $B (struct (ref $A) i32))) (type $C' (sub $B' (struct (ref $A') i32))) ;; These will get merged only after $c and $c' are merged. (type $D (sub $C (struct (ref $A) i32 i32))) + ;; CHECK: (type $D' (sub $C (struct (field (ref $A)) (field i32) (field i32)))) (type $D' (sub $C' (struct (ref $A') i32 i32))) ) @@ -653,24 +632,20 @@ (module (rec ;; CHECK: (rec - ;; CHECK-NEXT: (type $C (sub (struct (field (mut i32))))) - - ;; CHECK: (type $D (sub $C (struct (field (mut i32)) (field (mut i32))))) - - ;; CHECK: (type $H (sub $D (struct (field (mut i32)) (field (mut i32)) (field (mut (ref null $D)))))) - - ;; CHECK: (type $A (sub $H (struct (field (mut i32)) (field (mut i32)) (field (mut (ref null $D))) (field (mut i64)) (field (mut (ref null $I)))))) - - ;; CHECK: (type $I (array (mut (ref null $C)))) + ;; CHECK-NEXT: (type $I (array (mut (ref null $C)))) (type $I (array (mut (ref null $C)))) + ;; CHECK: (type $C (sub (struct (field (mut i32))))) (type $C (sub (struct (field (mut i32))))) + ;; CHECK: (type $D (sub $C (struct (field (mut i32)) (field (mut i32))))) (type $D (sub $C (struct (field (mut i32)) (field (mut i32))))) (type $E (sub $D (struct (field (mut i32)) (field (mut i32))))) (type $F (sub $E (struct (field (mut i32)) (field (mut i32))))) (type $D$to-merge (sub $F (struct (field (mut i32)) (field (mut i32))))) ;; CHECK: (type $G (func (param (ref $C)) (result (ref $D)))) (type $G (func (param (ref $C)) (result (ref $D)))) + ;; CHECK: (type $H (sub $D (struct (field (mut i32)) (field (mut i32)) (field (mut (ref null $D)))))) (type $H (sub $D (struct (field (mut i32)) (field (mut i32)) (field (mut (ref null $E)))))) + ;; CHECK: (type $A (sub $H (struct (field (mut i32)) (field (mut i32)) (field (mut (ref null $D))) (field (mut i64)) (field (mut (ref null $I)))))) (type $A (sub $H (struct (field (mut i32)) (field (mut i32)) (field (mut (ref null $E))) (field (mut i64)) (field (mut (ref null $I)))))) (type $A$to-merge (sub $A (struct (field (mut i32)) (field (mut i32)) (field (mut (ref null $E))) (field (mut i64)) (field (mut (ref null $I)))))) ) @@ -706,16 +681,14 @@ ;; Arrays (module ;; CHECK: (rec - ;; CHECK-NEXT: (type $refarray (sub (array anyref))) - - ;; CHECK: (type $sub-refarray-nn (sub $refarray (array (ref any)))) - - ;; CHECK: (type $intarray (sub (array (mut i32)))) + ;; CHECK-NEXT: (type $intarray (sub (array (mut i32)))) (type $intarray (sub (array (mut i32)))) (type $sub-intarray (sub $intarray (array (mut i32)))) + ;; CHECK: (type $refarray (sub (array anyref))) (type $refarray (sub (array (ref null any)))) (type $sub-refarray (sub $refarray (array (ref null any)))) + ;; CHECK: (type $sub-refarray-nn (sub $refarray (array (ref any)))) (type $sub-refarray-nn (sub $refarray (array (ref any)))) ;; CHECK: (type $3 (func)) @@ -872,11 +845,7 @@ ;; $x and $y are structurally identical, but won't be merged because there is ;; a cast to $y. ;; CHECK: (rec - ;; CHECK-NEXT: (type $b (sub (struct (field (ref null $x))))) - - ;; CHECK: (type $b1 (sub $b (struct (field (ref null $y))))) - - ;; CHECK: (type $x (sub (struct (field anyref)))) + ;; CHECK-NEXT: (type $x (sub (struct (field anyref)))) (type $x (sub (struct anyref))) ;; CHECK: (type $y (sub $x (struct (field anyref)))) (type $y (sub $x (struct anyref))) @@ -887,7 +856,9 @@ ;; subtype of $b. ;; CHECK: (type $a (struct (field (ref null $y)))) (type $a (struct (ref null $y))) + ;; CHECK: (type $b (sub (struct (field (ref null $x))))) (type $b (sub (struct (ref null $x)))) + ;; CHECK: (type $b1 (sub $b (struct (field (ref null $y))))) (type $b1 (sub $b (struct (ref null $y)))) ) @@ -927,10 +898,9 @@ (module (rec ;; CHECK: (rec - ;; CHECK-NEXT: (type $B (sub (func))) - - ;; CHECK: (type $A (sub (func (result (ref any) (ref $B))))) + ;; CHECK-NEXT: (type $A (sub (func (result (ref any) (ref $B))))) (type $A (sub (func (result (ref any) (ref $C))))) + ;; CHECK: (type $B (sub (func))) (type $B (sub (func))) (type $C (sub $B (func))) ;; CHECK: (type $D (sub final $A (func (result (ref any) (ref $B))))) @@ -966,15 +936,13 @@ (rec ;; CHECK: (type $A (sub (struct (field (ref null $A)) (field (ref null $I))))) (type $A (sub (struct (ref null $A) (ref null $I)))) - ;; CHECK: (type $C (sub $A (struct (field (ref null $A)) (field (ref null $K))))) - - ;; CHECK: (type $D2 (sub $C (struct (field (ref null $B)) (field (ref null $K))))) - ;; CHECK: (type $B (sub $A (struct (field (ref null $B)) (field (ref null $J))))) (type $B (sub $A (struct (ref null $B) (ref null $J)))) + ;; CHECK: (type $C (sub $A (struct (field (ref null $A)) (field (ref null $K))))) (type $C (sub $A (struct (ref null $A) (ref null $K)))) ;; CHECK: (type $D1 (sub $B (struct (field (ref null $B)) (field (ref null $K))))) (type $D1 (sub $B (struct (ref null $B) (ref null $K)))) + ;; CHECK: (type $D2 (sub $C (struct (field (ref null $B)) (field (ref null $K))))) (type $D2 (sub $C (struct (ref null $B) (ref null $K)))) ) @@ -997,18 +965,16 @@ ;; CHECK: (type $A (sub (struct (field (ref null $A)) (field (ref null $I))))) (type $A (sub (struct (ref null $A) (ref null $I)))) (type $A' (sub $A (struct (ref null $A) (ref null $I)))) - ;; CHECK: (type $C (sub $A (struct (field (ref null $A)) (field (ref null $K))))) - - ;; CHECK: (type $D2 (sub $C (struct (field (ref null $B)) (field (ref null $K))))) - ;; CHECK: (type $B (sub $A (struct (field (ref null $B)) (field (ref null $J))))) (type $B (sub $A' (struct (ref null $B) (ref null $J)))) (type $B' (sub $B (struct (ref null $B) (ref null $J)))) + ;; CHECK: (type $C (sub $A (struct (field (ref null $A)) (field (ref null $K))))) (type $C (sub $A' (struct (ref null $A) (ref null $K)))) (type $C' (sub $C (struct (ref null $A) (ref null $K)))) ;; CHECK: (type $D1 (sub $B (struct (field (ref null $B)) (field (ref null $K))))) (type $D1 (sub $B' (struct (ref null $B) (ref null $K)))) (type $D1' (sub $D1 (struct (ref null $B) (ref null $K)))) + ;; CHECK: (type $D2 (sub $C (struct (field (ref null $B)) (field (ref null $K))))) (type $D2 (sub $C' (struct (ref null $B) (ref null $K)))) (type $D2' (sub $D2 (struct (ref null $B) (ref null $K)))) ) diff --git a/test/lit/passes/unsubtyping.wast b/test/lit/passes/unsubtyping.wast index 590cc5ae1..0d4e11e12 100644 --- a/test/lit/passes/unsubtyping.wast +++ b/test/lit/passes/unsubtyping.wast @@ -1,14 +1,14 @@ ;; 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 -all -S -o - | filecheck %s (module ;; $sub1 and $sub2 should become parent types and $super should be removed. (type $super (sub (struct))) ;; CHECK: (rec - ;; CHECK-NEXT: (type $sub2 (sub (struct (field f32)))) - - ;; CHECK: (type $sub1 (sub (struct (field i32)))) + ;; CHECK-NEXT: (type $sub1 (sub (struct (field i32)))) (type $sub1 (sub $super (struct i32))) + ;; CHECK: (type $sub2 (sub (struct (field f32)))) (type $sub2 (sub $super (struct f32))) ;; CHECK: (global $sub1 (ref $sub1) (struct.new_default $sub1)) @@ -21,10 +21,9 @@ ;; Same result, but we start with $sub2 <: $sub1. (type $super (sub (struct))) ;; CHECK: (rec - ;; CHECK-NEXT: (type $sub2 (sub (struct (field i32) (field i32)))) - - ;; CHECK: (type $sub1 (sub (struct (field i32)))) + ;; CHECK-NEXT: (type $sub1 (sub (struct (field i32)))) (type $sub1 (sub $super (struct i32))) + ;; CHECK: (type $sub2 (sub (struct (field i32) (field i32)))) (type $sub2 (sub $sub1 (struct i32 i32))) ;; CHECK: (global $sub1 (ref $sub1) (struct.new_default $sub1)) @@ -214,12 +213,11 @@ (module ;; CHECK: (rec - ;; CHECK-NEXT: (type $opt (sub (struct (field i32)))) - - ;; CHECK: (type $super (sub (struct))) + ;; CHECK-NEXT: (type $super (sub (struct))) (type $super (sub (struct))) ;; CHECK: (type $sub (sub $super (struct))) (type $sub (sub $super (struct))) + ;; CHECK: (type $opt (sub (struct (field i32)))) (type $opt (sub $super (struct i32))) ;; CHECK: (type $3 (func)) @@ -439,11 +437,11 @@ ;; CHECK: (type $sub (sub $super (struct))) (type $sub (sub $super (struct))) - ;; CHECK: (type $2 (func (result (ref $sub)))) + ;; CHECK: (type $2 (func (result (ref $super)))) - ;; CHECK: (type $3 (func (result (ref $super)))) + ;; CHECK: (type $3 (func (result (ref $sub)))) - ;; CHECK: (func $return-call (type $3) (result (ref $super)) + ;; CHECK: (func $return-call (type $2) (result (ref $super)) ;; CHECK-NEXT: (return_call $callee) ;; CHECK-NEXT: ) (func $return-call (result (ref $super)) @@ -451,7 +449,7 @@ (return_call $callee) ) - ;; CHECK: (func $callee (type $2) (result (ref $sub)) + ;; CHECK: (func $callee (type $3) (result (ref $sub)) ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) (func $callee (result (ref $sub)) @@ -493,15 +491,15 @@ ;; CHECK: (type $sub (sub $super (struct))) (type $sub (sub $super (struct))) - ;; CHECK: (type $2 (func (result (ref $sub)))) + ;; CHECK: (type $2 (func (result (ref $super)))) - ;; CHECK: (type $3 (func (result (ref $super)))) + ;; CHECK: (type $3 (func (result (ref $sub)))) ;; CHECK: (table $t 1 1 funcref) (table $t 1 1 funcref) - ;; CHECK: (func $return-call-indirect (type $3) (result (ref $super)) - ;; CHECK-NEXT: (return_call_indirect $t (type $2) + ;; CHECK: (func $return-call-indirect (type $2) (result (ref $super)) + ;; CHECK-NEXT: (return_call_indirect $t (type $3) ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -515,10 +513,9 @@ (module ;; CHECK: (rec - ;; CHECK-NEXT: (type $sub (sub (func))) - - ;; CHECK: (type $super (sub (func))) + ;; CHECK-NEXT: (type $super (sub (func))) (type $super (sub (func))) + ;; CHECK: (type $sub (sub (func))) (type $sub (sub $super (func))) ;; CHECK: (table $t 1 1 (ref null $super)) @@ -620,10 +617,9 @@ ;; CHECK: (rec ;; CHECK-NEXT: (type $super (sub (struct))) (type $super (sub (struct))) - ;; CHECK: (type $sub2 (sub $super (struct (field i32)))) - ;; CHECK: (type $sub1 (sub $super (struct))) (type $sub1 (sub $super (struct))) + ;; CHECK: (type $sub2 (sub $super (struct (field i32)))) (type $sub2 (sub $super (struct i32))) ;; CHECK: (type $3 (func)) @@ -673,10 +669,9 @@ (module ;; CHECK: (rec - ;; CHECK-NEXT: (type $sub (sub (struct))) - - ;; CHECK: (type $super (sub (struct))) + ;; CHECK-NEXT: (type $super (sub (struct))) (type $super (sub (struct))) + ;; CHECK: (type $sub (sub (struct))) (type $sub (sub $super (struct))) ;; CHECK: (type $2 (func)) @@ -697,15 +692,13 @@ (module (rec ;; CHECK: (rec - ;; CHECK-NEXT: (type $super2 (sub (struct))) - - ;; CHECK: (type $sub2 (sub $super2 (struct))) - - ;; CHECK: (type $super1 (sub (struct))) + ;; CHECK-NEXT: (type $super1 (sub (struct))) (type $super1 (sub (struct))) + ;; CHECK: (type $super2 (sub (struct))) (type $super2 (sub (struct))) ;; CHECK: (type $sub1 (sub $super1 (struct))) (type $sub1 (sub $super1 (struct))) + ;; CHECK: (type $sub2 (sub $super2 (struct))) (type $sub2 (sub $super2 (struct))) ) @@ -788,20 +781,20 @@ (module ;; CHECK: (rec - ;; CHECK-NEXT: (type $0 (func)) - - ;; CHECK: (type $super (sub (struct))) + ;; CHECK-NEXT: (type $super (sub (struct))) (type $super (sub (struct))) ;; CHECK: (type $sub (sub $super (struct))) (type $sub (sub $super (struct))) + ;; CHECK: (type $2 (func)) + ;; CHECK: (table $super 1 1 (ref null $super)) (table $super 1 1 (ref null $super)) ;; CHECK: (table $sub 1 1 (ref null $sub)) (table $sub 1 1 (ref null $sub)) - ;; CHECK: (func $table-copy (type $0) + ;; CHECK: (func $table-copy (type $2) ;; CHECK-NEXT: (table.copy $super $sub ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: (i32.const 0) @@ -820,20 +813,20 @@ (module ;; CHECK: (rec - ;; CHECK-NEXT: (type $0 (func)) - - ;; CHECK: (type $super (sub (struct))) + ;; CHECK-NEXT: (type $super (sub (struct))) (type $super (sub (struct))) ;; CHECK: (type $sub (sub $super (struct))) (type $sub (sub $super (struct))) + ;; CHECK: (type $2 (func)) + ;; CHECK: (table $super 1 1 (ref null $super)) (table $super 1 1 (ref null $super)) ;; CHECK: (elem $sub (ref null $sub)) (elem $sub (ref null $sub)) - ;; CHECK: (func $table-copy (type $0) + ;; CHECK: (func $table-copy (type $2) ;; CHECK-NEXT: (table.init $super $sub ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: (i32.const 0) @@ -1134,13 +1127,12 @@ (module ;; CHECK: (rec - ;; CHECK-NEXT: (type $struct (sub (struct (field (ref null $super))))) - - ;; CHECK: (type $super (sub (struct))) + ;; CHECK-NEXT: (type $super (sub (struct))) (type $super (sub (struct))) ;; CHECK: (type $sub (sub $super (struct))) (type $sub (sub $super (struct))) + ;; CHECK: (type $struct (sub (struct (field (ref null $super))))) (type $struct (sub (struct (ref null $super)))) ;; CHECK: (type $3 (func)) @@ -1181,13 +1173,12 @@ (module ;; CHECK: (rec - ;; CHECK-NEXT: (type $struct (sub (struct (field (mut (ref null $super)))))) - - ;; CHECK: (type $super (sub (struct))) + ;; CHECK-NEXT: (type $super (sub (struct))) (type $super (sub (struct))) ;; CHECK: (type $sub (sub $super (struct))) (type $sub (sub $super (struct))) + ;; CHECK: (type $struct (sub (struct (field (mut (ref null $super)))))) (type $struct (sub (struct (mut (ref null $super))))) ;; CHECK: (type $3 (func (param (ref null $struct)))) @@ -1237,13 +1228,12 @@ (module ;; CHECK: (rec - ;; CHECK-NEXT: (type $array (sub (array (ref null $super)))) - - ;; CHECK: (type $super (sub (struct))) + ;; CHECK-NEXT: (type $super (sub (struct))) (type $super (sub (struct))) ;; CHECK: (type $sub (sub $super (struct))) (type $sub (sub $super (struct))) + ;; CHECK: (type $array (sub (array (ref null $super)))) (type $array (sub (array (ref null $super)))) ;; CHECK: (type $3 (func)) @@ -1298,21 +1288,20 @@ (module ;; CHECK: (rec - ;; CHECK-NEXT: (type $array (sub (array (ref null $super)))) - - ;; CHECK: (type $1 (func)) - - ;; CHECK: (type $super (sub (struct))) + ;; CHECK-NEXT: (type $super (sub (struct))) (type $super (sub (struct))) ;; CHECK: (type $sub (sub $super (struct))) (type $sub (sub $super (struct))) + ;; CHECK: (type $array (sub (array (ref null $super)))) (type $array (sub (array (ref null $super)))) + ;; CHECK: (type $3 (func)) + ;; CHECK: (elem $e (ref null $sub)) (elem $e (ref null $sub)) - ;; CHECK: (func $array-new-elem (type $1) + ;; CHECK: (func $array-new-elem (type $3) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (array.new_elem $array $e ;; CHECK-NEXT: (i32.const 0) @@ -1347,13 +1336,12 @@ (module ;; CHECK: (rec - ;; CHECK-NEXT: (type $array (sub (array (ref null $super)))) - - ;; CHECK: (type $super (sub (struct))) + ;; CHECK-NEXT: (type $super (sub (struct))) (type $super (sub (struct))) ;; CHECK: (type $sub (sub $super (struct))) (type $sub (sub $super (struct))) + ;; CHECK: (type $array (sub (array (ref null $super)))) (type $array (sub (array (ref null $super)))) ;; CHECK: (type $3 (func)) @@ -1457,10 +1445,9 @@ ;; CHECK: (type $sub (sub $super (struct))) (type $sub (sub $super (struct))) - ;; CHECK: (type $sub-array (sub (array (mut (ref null $sub))))) - ;; CHECK: (type $super-array (sub (array (mut (ref null $super))))) (type $super-array (sub (array (mut (ref null $super))))) + ;; CHECK: (type $sub-array (sub (array (mut (ref null $sub))))) (type $sub-array (sub (array (mut (ref null $sub))))) ;; CHECK: (type $4 (func)) @@ -1615,21 +1602,20 @@ (module ;; CHECK: (rec - ;; CHECK-NEXT: (type $array (sub (array (mut (ref null $super))))) - - ;; CHECK: (type $1 (func)) - - ;; CHECK: (type $super (sub (struct))) + ;; CHECK-NEXT: (type $super (sub (struct))) (type $super (sub (struct))) ;; CHECK: (type $sub (sub $super (struct))) (type $sub (sub $super (struct))) + ;; CHECK: (type $array (sub (array (mut (ref null $super))))) (type $array (sub (array (mut (ref null $super))))) + ;; CHECK: (type $3 (func)) + ;; CHECK: (elem $e (ref null $sub)) (elem $e (ref null $sub)) - ;; CHECK: (func $array-init-elem (type $1) + ;; CHECK: (func $array-init-elem (type $3) ;; CHECK-NEXT: (array.init_elem $array $e ;; CHECK-NEXT: (array.new_fixed $array 0) ;; CHECK-NEXT: (i32.const 0) |