blob: 0224569683913a5633a02991d8847114e1657f79 [file]
;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
;; RUN: wasm-opt %s -all --disable-custom-descriptors --minimize-rec-groups \
;; RUN: -S -o - | filecheck %s
(module
;; CHECK: (type $struct (struct))
(type $struct (struct))
;; CHECK: (type $exact (func (result (ref (exact $struct)) i32)))
(type $exact (func (result (ref (exact $struct)) i32)))
;; Make `func` public so all function types used for function references and
;; referenced functions become public.
;; CHECK: (type $2 (func))
;; CHECK: (type $3 (func (result (ref $struct) i32)))
;; CHECK: (table $0 1 funcref)
(table $0 1 funcref)
;; CHECK: (elem declare func $referenced)
;; CHECK: (export "table" (table $0))
(export "table" (table $0))
;; Combined with `func` being public, this makes $exact public.
;; CHECK: (func $referenced (type $exact) (result (ref (exact $struct)) i32)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (ref.func $referenced)
;; CHECK-NEXT: )
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
(func $referenced (type $exact)
(drop (ref.func $referenced))
(unreachable)
)
;; CHECK: (func $control-flow-type (type $2)
;; CHECK-NEXT: (tuple.drop 2
;; CHECK-NEXT: (block $l (type $3) (result (ref $struct) i32)
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $control-flow-type
;; This block type is parsed after the defined types, but it differs from
;; $exact only in exactness. We would not be able to parse this in a
;; binary because the parser would error on the type sections containing
;; types that differed only in exactness. However, the identities of
;; control flow types never matter, so as a convenience we allow parsing
;; this text. To maintain the invariant that we never have public types
;; that cannot be differentiated by the enabled feature set, we must not
;; consider types used only in control flow public. MinimizeRecGroups
;; would have an assertion failure otherwise.
(tuple.drop 2
(block $l (result (ref $struct) i32)
(unreachable)
)
)
)
)