diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/lit/passes/vacuum-strings.wast | 84 | ||||
-rw-r--r-- | test/passes/translate-to-fuzz_all-features_metrics_noprint.txt | 68 |
2 files changed, 119 insertions, 33 deletions
diff --git a/test/lit/passes/vacuum-strings.wast b/test/lit/passes/vacuum-strings.wast new file mode 100644 index 000000000..6925d52e6 --- /dev/null +++ b/test/lit/passes/vacuum-strings.wast @@ -0,0 +1,84 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. +;; RUN: wasm-opt %s --vacuum -all -S -o - | filecheck %s + +(module + ;; CHECK: (func $compare (type $0) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (string.compare + ;; CHECK-NEXT: (string.const "hello") + ;; CHECK-NEXT: (ref.null none) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (string.compare + ;; CHECK-NEXT: (ref.null none) + ;; CHECK-NEXT: (string.const "world") + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (string.compare + ;; CHECK-NEXT: (ref.null none) + ;; CHECK-NEXT: (ref.null none) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $compare + ;; We cannot vacuum away compares that might trap. + (drop + (string.compare + (string.const "hello") + (string.const "world") + ) + ) + (drop + (string.compare + (string.const "hello") + (ref.null none) + ) + ) + (drop + (string.compare + (ref.null none) + (string.const "world") + ) + ) + (drop + (string.compare + (ref.null none) + (ref.null none) + ) + ) + ) + + ;; CHECK: (func $eq (type $0) + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: ) + (func $eq + ;; Equals, however, never traps so all these can be removed. + (drop + (string.eq + (string.const "hello") + (string.const "world") + ) + ) + (drop + (string.eq + (string.const "hello") + (ref.null none) + ) + ) + (drop + (string.eq + (ref.null none) + (string.const "world") + ) + ) + (drop + (string.eq + (ref.null none) + (ref.null none) + ) + ) + ) +) + diff --git a/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt b/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt index 648cb053b..20b145a95 100644 --- a/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt +++ b/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt @@ -1,43 +1,45 @@ total - [exports] : 7 - [funcs] : 12 + [exports] : 4 + [funcs] : 6 [globals] : 14 [imports] : 5 [memories] : 1 [memory-data] : 20 - [table-data] : 6 + [table-data] : 1 [tables] : 1 [tags] : 1 - [total] : 493 - [vars] : 31 - ArrayNew : 1 - ArrayNewFixed : 1 - Binary : 61 - Block : 59 - Break : 2 - Call : 29 - CallRef : 1 - Const : 101 - Drop : 10 + [total] : 533 + [vars] : 24 + ArrayNew : 11 + ArrayNewFixed : 2 + AtomicFence : 1 + Binary : 79 + Block : 57 + Break : 6 + Call : 8 + Const : 137 + Drop : 1 GlobalGet : 28 - GlobalSet : 26 - I31Get : 1 - If : 17 - Load : 16 - LocalGet : 36 - LocalSet : 29 - Loop : 2 - Nop : 5 + GlobalSet : 28 + If : 15 + Load : 17 + LocalGet : 40 + LocalSet : 23 + Loop : 9 + Nop : 4 RefAs : 1 - RefCast : 2 - RefFunc : 8 - RefI31 : 4 - RefNull : 4 - Return : 3 - SIMDExtract : 1 - StringConst : 1 - StructNew : 5 - TupleExtract : 1 - TupleMake : 7 - Unary : 16 + RefFunc : 2 + RefI31 : 2 + RefIsNull : 1 + RefNull : 5 + Return : 2 + SIMDExtract : 2 + Select : 1 + Store : 2 + StringConst : 4 + StringEq : 1 + StructGet : 1 + StructNew : 9 + TupleMake : 4 + Unary : 15 Unreachable : 15 |