diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/example/module-splitting.txt | 16 | ||||
-rw-r--r-- | test/lit/help/wasm-as.test | 3 | ||||
-rw-r--r-- | test/lit/help/wasm-ctor-eval.test | 3 | ||||
-rw-r--r-- | test/lit/help/wasm-dis.test | 3 | ||||
-rw-r--r-- | test/lit/help/wasm-emscripten-finalize.test | 3 | ||||
-rw-r--r-- | test/lit/help/wasm-merge.test | 3 | ||||
-rw-r--r-- | test/lit/help/wasm-metadce.test | 8 | ||||
-rw-r--r-- | test/lit/help/wasm-opt.test | 6 | ||||
-rw-r--r-- | test/lit/help/wasm-reduce.test | 3 | ||||
-rw-r--r-- | test/lit/help/wasm-split.test | 3 | ||||
-rw-r--r-- | test/lit/help/wasm2js.test | 6 | ||||
-rw-r--r-- | test/lit/passes/remove-unused-types-preserve-order.wast | 81 |
12 files changed, 126 insertions, 12 deletions
diff --git a/test/example/module-splitting.txt b/test/example/module-splitting.txt index 69fabc816..b72867dda 100644 --- a/test/example/module-splitting.txt +++ b/test/example/module-splitting.txt @@ -629,10 +629,10 @@ Before: Keeping: null After: (module - (type $0 (func (param i32) (result i32))) - (type $1 (func)) + (type $0 (func)) + (type $1 (func (param i32) (result i32))) (import "env" "base" (global $base i32)) - (import "placeholder" "0" (func $placeholder_0 (type $0) (param i32) (result i32))) + (import "placeholder" "0" (func $placeholder_0 (type $1) (param i32) (result i32))) (table $table 1000 funcref) (table $0 1 funcref) (elem $0 (table $table) (global.get $base) func $null $trampoline_foo) @@ -641,17 +641,17 @@ After: (export "%table" (table $table)) (export "%table_2" (table $0)) (export "%global" (global $base)) - (func $null (type $1) + (func $null (type $0) (nop) ) - (func $foo (type $0) (param $0 i32) (result i32) - (call_indirect $0 (type $0) + (func $foo (type $1) (param $0 i32) (result i32) + (call_indirect $0 (type $1) (local.get $0) (i32.const 0) ) ) - (func $trampoline_foo (type $0) (param $0 i32) (result i32) - (call_indirect $0 (type $0) + (func $trampoline_foo (type $1) (param $0 i32) (result i32) + (call_indirect $0 (type $1) (local.get $0) (i32.const 0) ) diff --git a/test/lit/help/wasm-as.test b/test/lit/help/wasm-as.test index a2ee3d45e..5dd4b1515 100644 --- a/test/lit/help/wasm-as.test +++ b/test/lit/help/wasm-as.test @@ -139,6 +139,9 @@ ;; CHECK-NEXT: them and pass them back in, but not ;; CHECK-NEXT: inspect their contents or call them. ;; CHECK-NEXT: +;; CHECK-NEXT: --preserve-type-order Preserve the order of types from the +;; CHECK-NEXT: input (useful for debugging and testing) +;; CHECK-NEXT: ;; CHECK-NEXT: --generate-stack-ir generate StackIR during writing ;; CHECK-NEXT: ;; CHECK-NEXT: --optimize-stack-ir optimize StackIR during writing diff --git a/test/lit/help/wasm-ctor-eval.test b/test/lit/help/wasm-ctor-eval.test index 4ad75a8d0..abb80b12e 100644 --- a/test/lit/help/wasm-ctor-eval.test +++ b/test/lit/help/wasm-ctor-eval.test @@ -146,6 +146,9 @@ ;; CHECK-NEXT: them and pass them back in, but not ;; CHECK-NEXT: inspect their contents or call them. ;; CHECK-NEXT: +;; CHECK-NEXT: --preserve-type-order Preserve the order of types from the +;; CHECK-NEXT: input (useful for debugging and testing) +;; CHECK-NEXT: ;; CHECK-NEXT: --generate-stack-ir generate StackIR during writing ;; CHECK-NEXT: ;; CHECK-NEXT: --optimize-stack-ir optimize StackIR during writing diff --git a/test/lit/help/wasm-dis.test b/test/lit/help/wasm-dis.test index 96e999c2c..90bc12b99 100644 --- a/test/lit/help/wasm-dis.test +++ b/test/lit/help/wasm-dis.test @@ -132,6 +132,9 @@ ;; CHECK-NEXT: them and pass them back in, but not ;; CHECK-NEXT: inspect their contents or call them. ;; CHECK-NEXT: +;; CHECK-NEXT: --preserve-type-order Preserve the order of types from the +;; CHECK-NEXT: input (useful for debugging and testing) +;; CHECK-NEXT: ;; CHECK-NEXT: --generate-stack-ir generate StackIR during writing ;; CHECK-NEXT: ;; CHECK-NEXT: --optimize-stack-ir optimize StackIR during writing diff --git a/test/lit/help/wasm-emscripten-finalize.test b/test/lit/help/wasm-emscripten-finalize.test index fbf86209c..cdd378d40 100644 --- a/test/lit/help/wasm-emscripten-finalize.test +++ b/test/lit/help/wasm-emscripten-finalize.test @@ -174,6 +174,9 @@ ;; CHECK-NEXT: them and pass them back in, but not ;; CHECK-NEXT: inspect their contents or call them. ;; CHECK-NEXT: +;; CHECK-NEXT: --preserve-type-order Preserve the order of types from the +;; CHECK-NEXT: input (useful for debugging and testing) +;; CHECK-NEXT: ;; CHECK-NEXT: --generate-stack-ir generate StackIR during writing ;; CHECK-NEXT: ;; CHECK-NEXT: --optimize-stack-ir optimize StackIR during writing diff --git a/test/lit/help/wasm-merge.test b/test/lit/help/wasm-merge.test index 108fd3673..ee1fed13a 100644 --- a/test/lit/help/wasm-merge.test +++ b/test/lit/help/wasm-merge.test @@ -162,6 +162,9 @@ ;; CHECK-NEXT: them and pass them back in, but not ;; CHECK-NEXT: inspect their contents or call them. ;; CHECK-NEXT: +;; CHECK-NEXT: --preserve-type-order Preserve the order of types from the +;; CHECK-NEXT: input (useful for debugging and testing) +;; CHECK-NEXT: ;; CHECK-NEXT: --generate-stack-ir generate StackIR during writing ;; CHECK-NEXT: ;; CHECK-NEXT: --optimize-stack-ir optimize StackIR during writing diff --git a/test/lit/help/wasm-metadce.test b/test/lit/help/wasm-metadce.test index 4ddf55203..50295b1f0 100644 --- a/test/lit/help/wasm-metadce.test +++ b/test/lit/help/wasm-metadce.test @@ -248,9 +248,9 @@ ;; CHECK-NEXT: ;; CHECK-NEXT: --merge-blocks merges blocks to their parents ;; CHECK-NEXT: -;; CHECK-NEXT: --merge-j2cl-itables Merges itable structures into +;; CHECK-NEXT: --merge-j2cl-itables Merges itable structures into ;; CHECK-NEXT: vtables to make types more -;; CHECK-NEXT: compact +;; CHECK-NEXT: compact ;; CHECK-NEXT: ;; CHECK-NEXT: --merge-locals merges locals when beneficial ;; CHECK-NEXT: @@ -771,6 +771,10 @@ ;; CHECK-NEXT: in, but not inspect their ;; CHECK-NEXT: contents or call them. ;; CHECK-NEXT: +;; CHECK-NEXT: --preserve-type-order Preserve the order of types from +;; CHECK-NEXT: the input (useful for debugging +;; CHECK-NEXT: and testing) +;; CHECK-NEXT: ;; CHECK-NEXT: --generate-stack-ir generate StackIR during writing ;; CHECK-NEXT: ;; CHECK-NEXT: --optimize-stack-ir optimize StackIR during writing diff --git a/test/lit/help/wasm-opt.test b/test/lit/help/wasm-opt.test index f55798253..0691d1c18 100644 --- a/test/lit/help/wasm-opt.test +++ b/test/lit/help/wasm-opt.test @@ -257,7 +257,7 @@ ;; CHECK-NEXT: ;; CHECK-NEXT: --merge-blocks merges blocks to their parents ;; CHECK-NEXT: -;; CHECK-NEXT: --merge-j2cl-itables Merges itable structures into +;; CHECK-NEXT: --merge-j2cl-itables Merges itable structures into ;; CHECK-NEXT: vtables to make types more ;; CHECK-NEXT: compact ;; CHECK-NEXT: @@ -780,6 +780,10 @@ ;; CHECK-NEXT: in, but not inspect their ;; CHECK-NEXT: contents or call them. ;; CHECK-NEXT: +;; CHECK-NEXT: --preserve-type-order Preserve the order of types from +;; CHECK-NEXT: the input (useful for debugging +;; CHECK-NEXT: and testing) +;; CHECK-NEXT: ;; CHECK-NEXT: --generate-stack-ir generate StackIR during writing ;; CHECK-NEXT: ;; CHECK-NEXT: --optimize-stack-ir optimize StackIR during writing diff --git a/test/lit/help/wasm-reduce.test b/test/lit/help/wasm-reduce.test index 61e171ba9..cc75aed2b 100644 --- a/test/lit/help/wasm-reduce.test +++ b/test/lit/help/wasm-reduce.test @@ -168,6 +168,9 @@ ;; CHECK-NEXT: them and pass them back in, but not ;; CHECK-NEXT: inspect their contents or call them. ;; CHECK-NEXT: +;; CHECK-NEXT: --preserve-type-order Preserve the order of types from the +;; CHECK-NEXT: input (useful for debugging and testing) +;; CHECK-NEXT: ;; CHECK-NEXT: --generate-stack-ir generate StackIR during writing ;; CHECK-NEXT: ;; CHECK-NEXT: --optimize-stack-ir optimize StackIR during writing diff --git a/test/lit/help/wasm-split.test b/test/lit/help/wasm-split.test index a6074c85d..dc521a82f 100644 --- a/test/lit/help/wasm-split.test +++ b/test/lit/help/wasm-split.test @@ -249,6 +249,9 @@ ;; CHECK-NEXT: them and pass them back in, but not ;; CHECK-NEXT: inspect their contents or call them. ;; CHECK-NEXT: +;; CHECK-NEXT: --preserve-type-order Preserve the order of types from the +;; CHECK-NEXT: input (useful for debugging and testing) +;; CHECK-NEXT: ;; CHECK-NEXT: --generate-stack-ir generate StackIR during writing ;; CHECK-NEXT: ;; CHECK-NEXT: --optimize-stack-ir optimize StackIR during writing diff --git a/test/lit/help/wasm2js.test b/test/lit/help/wasm2js.test index 39c4d5f5e..89dcaa028 100644 --- a/test/lit/help/wasm2js.test +++ b/test/lit/help/wasm2js.test @@ -211,7 +211,7 @@ ;; CHECK-NEXT: ;; CHECK-NEXT: --merge-blocks merges blocks to their parents ;; CHECK-NEXT: -;; CHECK-NEXT: --merge-j2cl-itables Merges itable structures into +;; CHECK-NEXT: --merge-j2cl-itables Merges itable structures into ;; CHECK-NEXT: vtables to make types more ;; CHECK-NEXT: compact ;; CHECK-NEXT: @@ -734,6 +734,10 @@ ;; CHECK-NEXT: in, but not inspect their ;; CHECK-NEXT: contents or call them. ;; CHECK-NEXT: +;; CHECK-NEXT: --preserve-type-order Preserve the order of types from +;; CHECK-NEXT: the input (useful for debugging +;; CHECK-NEXT: and testing) +;; CHECK-NEXT: ;; CHECK-NEXT: --generate-stack-ir generate StackIR during writing ;; CHECK-NEXT: ;; CHECK-NEXT: --optimize-stack-ir optimize StackIR during writing diff --git a/test/lit/passes/remove-unused-types-preserve-order.wast b/test/lit/passes/remove-unused-types-preserve-order.wast new file mode 100644 index 000000000..12f467e58 --- /dev/null +++ b/test/lit/passes/remove-unused-types-preserve-order.wast @@ -0,0 +1,81 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. + +;; RUN: wasm-opt %s -all --closed-world --preserve-type-order \ +;; RUN: --remove-unused-types -S -o - | filecheck %s +;; RUN: wasm-opt %s -all --closed-world --preserve-type-order \ +;; RUN: --remove-unused-types --roundtrip -S -o - | filecheck %s + +(module + (rec + (type $unused-1 (struct)) + ;; CHECK: (rec + ;; CHECK-NEXT: (type $A (struct)) + (type $A (struct)) + (type $unused-2 (struct)) + ) + ;; CHECK: (type $B (struct)) + (type $B (struct)) + (type $unused-3 (struct (field i32))) + (rec + ;; CHECK: (type $C (struct (field (ref null $D)))) + (type $C (struct (field (ref null $D)))) + (type $unused-4 (struct)) + ;; CHECK: (type $D (struct (field (ref null $C)))) + (type $D (struct (field (ref null $C)))) + ) + ;; CHECK: (type $E (struct (field (ref null $E)))) + (type $E (struct (field (ref null $E)))) + + ;; Use the types in a shuffled order, using later types the most. If we + ;; weren't deliberately and correctly preserving type order, we would end up + ;; with some other order. + + ;; CHECK: (global $E1 (ref null $E) (ref.null none)) + (global $E1 (ref null $E) (ref.null none)) + ;; CHECK: (global $E2 (ref null $E) (ref.null none)) + (global $E2 (ref null $E) (ref.null none)) + ;; CHECK: (global $E3 (ref null $E) (ref.null none)) + (global $E3 (ref null $E) (ref.null none)) + ;; CHECK: (global $E4 (ref null $E) (ref.null none)) + (global $E4 (ref null $E) (ref.null none)) + ;; CHECK: (global $E5 (ref null $E) (ref.null none)) + (global $E5 (ref null $E) (ref.null none)) + ;; CHECK: (global $E6 (ref null $E) (ref.null none)) + (global $E6 (ref null $E) (ref.null none)) + ;; CHECK: (global $E7 (ref null $E) (ref.null none)) + (global $E7 (ref null $E) (ref.null none)) + ;; CHECK: (global $E8 (ref null $E) (ref.null none)) + (global $E8 (ref null $E) (ref.null none)) + ;; CHECK: (global $E9 (ref null $E) (ref.null none)) + (global $E9 (ref null $E) (ref.null none)) + + ;; CHECK: (global $C1 (ref null $C) (ref.null none)) + (global $C1 (ref null $C) (ref.null none)) + ;; CHECK: (global $C2 (ref null $C) (ref.null none)) + (global $C2 (ref null $C) (ref.null none)) + ;; CHECK: (global $C3 (ref null $C) (ref.null none)) + (global $C3 (ref null $C) (ref.null none)) + ;; CHECK: (global $C4 (ref null $C) (ref.null none)) + (global $C4 (ref null $C) (ref.null none)) + ;; CHECK: (global $C5 (ref null $C) (ref.null none)) + (global $C5 (ref null $C) (ref.null none)) + ;; CHECK: (global $C6 (ref null $C) (ref.null none)) + (global $C6 (ref null $C) (ref.null none)) + + ;; CHECK: (global $A1 (ref null $A) (ref.null none)) + (global $A1 (ref null $A) (ref.null none)) + ;; CHECK: (global $A2 (ref null $A) (ref.null none)) + (global $A2 (ref null $A) (ref.null none)) + ;; CHECK: (global $A3 (ref null $A) (ref.null none)) + (global $A3 (ref null $A) (ref.null none)) + ;; CHECK: (global $A4 (ref null $A) (ref.null none)) + (global $A4 (ref null $A) (ref.null none)) + + ;; CHECK: (global $D1 (ref null $D) (ref.null none)) + (global $D1 (ref null $D) (ref.null none)) + ;; CHECK: (global $D2 (ref null $D) (ref.null none)) + (global $D2 (ref null $D) (ref.null none)) + + ;; CHECK: (global $B1 (ref null $B) (ref.null none)) + (global $B1 (ref null $B) (ref.null none)) +) |