|
| 1 | +;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. |
| 2 | + |
| 3 | +;; Check that public tag types are correctly considered public and do not become |
| 4 | +;; part of the single, large rec group. |
| 5 | + |
| 6 | +;; RUN: foreach %s %t wasm-opt --remove-unused-types --closed-world -all -S -o - | filecheck %s |
| 7 | + |
| 8 | +;; Neither imported nor exported tag. The tag type is private. |
| 9 | +(module |
| 10 | + ;; CHECK: (rec |
| 11 | + ;; CHECK-NEXT: (type $other-2 (struct (field i8))) |
| 12 | + |
| 13 | + ;; CHECK: (type $other-1 (struct)) |
| 14 | + |
| 15 | + ;; CHECK: (type $tag-type (func)) |
| 16 | + (type $tag-type (func)) |
| 17 | + (type $other-1 (struct)) |
| 18 | + (type $other-2 (struct (field i8))) |
| 19 | + |
| 20 | + ;; CHECK: (global $tag-type (ref null $tag-type) (ref.null nofunc)) |
| 21 | + |
| 22 | + ;; CHECK: (global $other-1 (ref null $other-1) (ref.null none)) |
| 23 | + |
| 24 | + ;; CHECK: (global $other-2 (ref null $other-2) (ref.null none)) |
| 25 | + |
| 26 | + ;; CHECK: (tag $exported (type $tag-type)) |
| 27 | + (tag $exported (type $tag-type)) |
| 28 | + |
| 29 | + ;; Use all the types. |
| 30 | + (global $tag-type (ref null $tag-type) (ref.null nofunc)) |
| 31 | + (global $other-1 (ref null $other-1) (ref.null none)) |
| 32 | + (global $other-2 (ref null $other-2) (ref.null none)) |
| 33 | +) |
| 34 | + |
| 35 | +;; Imported tag. |
| 36 | +(module |
| 37 | + ;; CHECK: (type $tag-type (func)) |
| 38 | + (type $tag-type (func)) |
| 39 | + ;; CHECK: (rec |
| 40 | + ;; CHECK-NEXT: (type $other-2 (struct (field i8))) |
| 41 | + |
| 42 | + ;; CHECK: (type $other-1 (struct)) |
| 43 | + (type $other-1 (struct)) |
| 44 | + (type $other-2 (struct (field i8))) |
| 45 | + |
| 46 | + (tag $imported (import "" "") (type $tag-type)) |
| 47 | + |
| 48 | + ;; Use all the types. |
| 49 | + ;; CHECK: (import "" "" (tag $imported (type $tag-type))) |
| 50 | + |
| 51 | + ;; CHECK: (global $tag-type (ref null $tag-type) (ref.null nofunc)) |
| 52 | + (global $tag-type (ref null $tag-type) (ref.null nofunc)) |
| 53 | + ;; CHECK: (global $other-1 (ref null $other-1) (ref.null none)) |
| 54 | + (global $other-1 (ref null $other-1) (ref.null none)) |
| 55 | + ;; CHECK: (global $other-2 (ref null $other-2) (ref.null none)) |
| 56 | + (global $other-2 (ref null $other-2) (ref.null none)) |
| 57 | +) |
| 58 | + |
| 59 | +;; Exported tag. |
| 60 | +(module |
| 61 | + ;; CHECK: (type $tag-type (func)) |
| 62 | + (type $tag-type (func)) |
| 63 | + ;; CHECK: (rec |
| 64 | + ;; CHECK-NEXT: (type $other-2 (struct (field i8))) |
| 65 | + |
| 66 | + ;; CHECK: (type $other-1 (struct)) |
| 67 | + (type $other-1 (struct)) |
| 68 | + (type $other-2 (struct (field i8))) |
| 69 | + |
| 70 | + ;; CHECK: (global $tag-type (ref null $tag-type) (ref.null nofunc)) |
| 71 | + |
| 72 | + ;; CHECK: (global $other-1 (ref null $other-1) (ref.null none)) |
| 73 | + |
| 74 | + ;; CHECK: (global $other-2 (ref null $other-2) (ref.null none)) |
| 75 | + |
| 76 | + ;; CHECK: (tag $exported (type $tag-type)) |
| 77 | + (tag $exported (export "") (type $tag-type)) |
| 78 | + |
| 79 | + ;; Use all the types. |
| 80 | + (global $tag-type (ref null $tag-type) (ref.null nofunc)) |
| 81 | + (global $other-1 (ref null $other-1) (ref.null none)) |
| 82 | + (global $other-2 (ref null $other-2) (ref.null none)) |
| 83 | +) |
| 84 | +;; CHECK: (export "" (tag $exported)) |
0 commit comments