blob: b8d0a1c8ea4ee43800263cf658bf66ec03d8c1b6 [file] [log] [blame] [edit]
;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.
;; RUN: foreach %s %t wasm-opt -all -S -o - | filecheck %s
;; RUN: foreach %s %t wasm-opt -all --roundtrip -S -o - | filecheck %s
(module
;; Test that we order groups by average uses.
(rec
;; CHECK: (rec
;; CHECK-NEXT: (type $unused-6 (sub (struct)))
;; CHECK: (type $used-a-bit (sub (struct)))
;; CHECK: (rec
;; CHECK-NEXT: (type $unused-1 (sub (struct)))
(type $unused-1 (sub (struct)))
;; CHECK: (type $unused-2 (sub (struct)))
(type $unused-2 (sub (struct)))
;; CHECK: (type $unused-3 (sub (struct)))
(type $unused-3 (sub (struct)))
;; CHECK: (type $unused-4 (sub (struct)))
(type $unused-4 (sub (struct)))
;; CHECK: (type $used-a-lot (sub (struct)))
(type $used-a-lot (sub (struct)))
;; CHECK: (type $unused-5 (sub (struct)))
(type $unused-5 (sub (struct)))
)
(rec
(type $unused-6 (sub (struct)))
(type $used-a-bit (sub (struct)))
)
;; CHECK: (func $use (type $8) (param $0 (ref $used-a-lot)) (param $1 (ref $used-a-lot)) (param $2 (ref $used-a-lot)) (param $3 (ref $used-a-lot)) (param $4 (ref $used-a-lot)) (param $5 (ref $used-a-lot)) (result (ref $used-a-bit) (ref $used-a-bit) (ref $used-a-bit) (ref $used-a-bit))
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
(func $use (param (ref $used-a-lot) (ref $used-a-lot) (ref $used-a-lot) (ref $used-a-lot) (ref $used-a-lot) (ref $used-a-lot)) (result (ref $used-a-bit) (ref $used-a-bit) (ref $used-a-bit) (ref $used-a-bit))
(unreachable)
)
)
(module
;; Test that we respect dependencies between groups before considering counts.
(rec
;; CHECK: (rec
;; CHECK-NEXT: (type $leaf (sub (struct)))
(type $leaf (sub (struct)))
;; CHECK: (type $unused (sub (struct)))
(type $unused (sub (struct)))
)
(rec
;; CHECK: (rec
;; CHECK-NEXT: (type $shrub (sub $leaf (struct)))
;; CHECK: (type $used-a-ton (sub (struct)))
;; CHECK: (rec
;; CHECK-NEXT: (type $twig (sub (struct)))
(type $twig (sub (struct)))
;; CHECK: (type $used-a-bit (sub (struct (field (ref $leaf)))))
(type $used-a-bit (sub (struct (ref $leaf))))
)
(rec
(type $shrub (sub $leaf (struct)))
(type $used-a-ton (sub (struct)))
)
(rec
;; CHECK: (rec
;; CHECK-NEXT: (type $root (sub (struct)))
(type $root (sub (struct)))
;; CHECK: (type $used-a-lot (sub $twig (struct)))
(type $used-a-lot (sub $twig (struct)))
)
;; CHECK: (func $use (type $8) (param $0 (ref $used-a-lot)) (param $1 (ref $used-a-lot)) (param $2 (ref $used-a-lot)) (param $3 (ref $used-a-lot)) (param $4 (ref $used-a-lot)) (param $5 (ref $used-a-lot)) (result (ref $used-a-bit) (ref $used-a-bit) (ref $used-a-bit))
;; CHECK-NEXT: (local $6 (ref null $used-a-ton))
;; CHECK-NEXT: (local $7 (ref null $used-a-ton))
;; CHECK-NEXT: (local $8 (ref null $used-a-ton))
;; CHECK-NEXT: (local $9 (ref null $used-a-ton))
;; CHECK-NEXT: (local $10 (ref null $used-a-ton))
;; CHECK-NEXT: (local $11 (ref null $used-a-ton))
;; CHECK-NEXT: (local $12 (ref null $used-a-ton))
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
(func $use (param (ref $used-a-lot) (ref $used-a-lot) (ref $used-a-lot) (ref $used-a-lot) (ref $used-a-lot) (ref $used-a-lot)) (result (ref $used-a-bit) (ref $used-a-bit) (ref $used-a-bit))
(local (ref null $used-a-ton) (ref null $used-a-ton) (ref null $used-a-ton) (ref null $used-a-ton) (ref null $used-a-ton) (ref null $used-a-ton) (ref null $used-a-ton))
(unreachable)
)
)
(module
;; Test that basic heap type children do not trigger assertions.
(rec
;; CHECK: (type $contains-basic (sub (struct (field (ref any)))))
(type $contains-basic (sub (struct (ref any))))
)
;; CHECK: (func $use (type $1) (param $0 (ref $contains-basic))
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
(func $use (param (ref $contains-basic))
(unreachable)
)
)