| ;; 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 --dae --minimize-rec-groups \ |
| ;; RUN: -S -o - | filecheck %s |
| |
| (module |
| ;; CHECK: (type $struct (struct)) |
| (type $struct (struct)) |
| |
| ;; This type is public because `func` is exposed and there is a referenced |
| ;; function of this type. DAE will optimized the unreferenced function of this |
| ;; type to take an exact reference, but that optimized type will _not_ be |
| ;; public. This is important because otherwise MinimizeRecGroups would fail an |
| ;; assertion that all public types are distinguishable given the enabled |
| ;; features. This assertion would fail because the original and optimized |
| ;; types differ only in the exactness of a reference, but custom descriptors |
| ;; is disabled. |
| ;; CHECK: (type $1 (func)) |
| |
| ;; CHECK: (type $f (func (param (ref null $struct)))) |
| (type $f (func (param (ref null $struct)))) |
| |
| ;; CHECK: (rec |
| ;; CHECK-NEXT: (type $3 (struct)) |
| |
| ;; CHECK: (type $4 (func (param (ref null (exact $struct))))) |
| |
| ;; CHECK: (global $g (mut anyref) (ref.null none)) |
| (global $g (mut anyref) (ref.null none)) |
| ;; CHECK: (global $func funcref (ref.null nofunc)) |
| (global $func funcref (ref.null nofunc)) |
| ;; CHECK: (elem declare func $referenced) |
| |
| ;; CHECK: (export "func" (global $func)) |
| (export "func" (global $func)) |
| |
| ;; CHECK: (func $caller (type $1) |
| ;; CHECK-NEXT: (call $unreferenced |
| ;; CHECK-NEXT: (struct.new_default $struct) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: (call $unreferenced |
| ;; CHECK-NEXT: (ref.null none) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: (drop |
| ;; CHECK-NEXT: (ref.func $referenced) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: ) |
| (func $caller |
| ;; $unreferenced will be optimized to take (ref null (exact $struct)) |
| (call $unreferenced (struct.new $struct)) |
| (call $unreferenced (ref.null none)) |
| ;; $referenced will not be optimized. |
| (drop (ref.func $referenced)) |
| ) |
| |
| ;; CHECK: (func $unreferenced (type $4) (param $struct (ref null (exact $struct))) |
| ;; CHECK-NEXT: (global.set $g |
| ;; CHECK-NEXT: (local.get $struct) |
| ;; CHECK-NEXT: ) |
| ;; CHECK-NEXT: ) |
| (func $unreferenced (type $f) (param $struct (ref null $struct)) |
| ;; Use the parameter to keep it alive. |
| (global.set $g (local.get $struct)) |
| ) |
| |
| ;; CHECK: (func $referenced (type $f) (param $0 (ref null $struct)) |
| ;; CHECK-NEXT: (nop) |
| ;; CHECK-NEXT: ) |
| (func $referenced (type $f) (param $0 (ref null $struct)) |
| (nop) |
| ) |
| ) |