summaryrefslogtreecommitdiff
path: root/test/lit/passes/merge-similar-functions_all-features.wast
diff options
context:
space:
mode:
Diffstat (limited to 'test/lit/passes/merge-similar-functions_all-features.wast')
-rw-r--r--test/lit/passes/merge-similar-functions_all-features.wast90
1 files changed, 90 insertions, 0 deletions
diff --git a/test/lit/passes/merge-similar-functions_all-features.wast b/test/lit/passes/merge-similar-functions_all-features.wast
new file mode 100644
index 000000000..deda3b36b
--- /dev/null
+++ b/test/lit/passes/merge-similar-functions_all-features.wast
@@ -0,0 +1,90 @@
+;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.
+;; RUN: foreach %s %t wasm-opt --all-features --merge-similar-functions -S -o - | filecheck %s
+
+(module
+ ;; CHECK: (type $[i8] (array i8))
+ (type $[i8] (array i8))
+
+ ;; CHECK: (func $take-ref-null-data (param $0 (ref null data))
+ ;; CHECK-NEXT: (unreachable)
+ ;; CHECK-NEXT: )
+ (func $take-ref-null-data (param (ref null data))
+ (unreachable)
+ )
+ ;; CHECK: (func $take-ref-eq (param $0 (ref eq))
+ ;; CHECK-NEXT: (unreachable)
+ ;; CHECK-NEXT: )
+ (func $take-ref-eq (param (ref eq))
+ (unreachable)
+ )
+
+ ;; NOTE: When type A is a subtype of type B and type C,
+ ;; and func X takes a type B arg, and func Y takes a type C arg.
+ ;; Then both func X and Y are callable with a type A arg.
+ ;; But in general, type B and C don't have a common subtype, so
+ ;; we can't merge call instructions of func X and Y.
+
+ ;; CHECK: (func $no-call-subtyping-same-operand-0
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (call $take-ref-null-data
+ ;; CHECK-NEXT: (array.init_static $[i8])
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $no-call-subtyping-same-operand-0
+ (nop) (nop) (nop) (nop) (nop) (nop)
+ (nop) (nop) (nop) (nop) (nop) (nop)
+ (nop) (nop) (nop) (nop) (nop) (nop)
+ (call $take-ref-null-data
+ (array.init_static $[i8])
+ )
+ )
+ ;; CHECK: (func $no-call-subtyping-same-operand-1
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: (call $take-ref-eq
+ ;; CHECK-NEXT: (array.init_static $[i8])
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $no-call-subtyping-same-operand-1
+ (nop) (nop) (nop) (nop) (nop) (nop)
+ (nop) (nop) (nop) (nop) (nop) (nop)
+ (nop) (nop) (nop) (nop) (nop) (nop)
+ (call $take-ref-eq
+ (array.init_static $[i8])
+ )
+ )
+
+)