diff options
Diffstat (limited to 'test/lit/passes/optimize-instructions-gc.wast')
-rw-r--r-- | test/lit/passes/optimize-instructions-gc.wast | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/lit/passes/optimize-instructions-gc.wast b/test/lit/passes/optimize-instructions-gc.wast new file mode 100644 index 000000000..31ecd0f63 --- /dev/null +++ b/test/lit/passes/optimize-instructions-gc.wast @@ -0,0 +1,33 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. +;; RUN: wasm-opt %s --optimize-instructions --enable-reference-types --enable-gc -S -o - \ +;; RUN: | filecheck %s + +(module + ;; These functions test if an `if` with subtyped arms is correctly folded + ;; 1. if its `ifTrue` and `ifFalse` arms are identical (can fold) + ;; CHECK: (func $if-arms-subtype-fold (result anyref) + ;; CHECK-NEXT: (ref.null extern) + ;; CHECK-NEXT: ) + (func $if-arms-subtype-fold (result anyref) + (if (result anyref) + (i32.const 0) + (ref.null extern) + (ref.null extern) + ) + ) + ;; 2. if its `ifTrue` and `ifFalse` arms are not identical (cannot fold) + ;; CHECK: (func $if-arms-subtype-nofold (result anyref) + ;; CHECK-NEXT: (if (result anyref) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: (ref.null extern) + ;; CHECK-NEXT: (ref.null func) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $if-arms-subtype-nofold (result anyref) + (if (result anyref) + (i32.const 0) + (ref.null extern) + (ref.null func) + ) + ) +) |