summaryrefslogtreecommitdiff
path: root/test/lit/passes/remove-unused-types.wast
blob: 859290b6ea09f2e7ad96215beda1afeb5a8796e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.

;; RUN: wasm-opt %s --remove-unused-types --closed-world -all -S -o - | filecheck %s

(module
 (rec
  ;; CHECK:      (rec
  ;; CHECK-NEXT:  (type $mutually-used-2 (struct (field (ref null $mutually-used-1))))

  ;; CHECK:       (type $indirectly-used (struct))

  ;; CHECK:       (type $mutually-used-1 (struct (field (ref null $mutually-used-2))))

  ;; CHECK:       (type $directly-used (struct (field (ref null $indirectly-used))))

  ;; CHECK:       (type $used (struct))
  (type $used (struct))
  (type $unused (struct))
 )
 (rec
  (type $indirectly-used (struct))
  (type $directly-used (struct (ref null $indirectly-used)))
  (type $unused2 (struct (ref null $unused2)))
  (type $unused3 (struct (ref null $unused2)))
 )
 (rec
  (type $mutually-used-1 (struct (ref null $mutually-used-2)))
  (type $mutually-used-2 (struct (ref null $mutually-used-1)))
  (type $mutually-unused-1 (struct (ref null $mutually-unused-2)))
  (type $mutually-unused-2 (struct (ref null $mutually-unused-1)))
 )

 ;; CHECK:      (global $g1 (ref null $used) (ref.null none))
 (global $g1 (ref null $used) (ref.null none))
 ;; CHECK:      (global $g2 (ref null $directly-used) (ref.null none))
 (global $g2 (ref null $directly-used) (ref.null none))
 ;; CHECK:      (global $g4 (ref null $mutually-used-1) (ref.null none))
 (global $g4 (ref null $mutually-used-1) (ref.null none))
)