summaryrefslogtreecommitdiff
path: root/test/lit/passes/roundtrip-gc-types.wast
blob: 8f1bf4e821cac14649f370dd3509c4756cfc4c27 (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
;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.

;; RUN: wasm-opt %s -all --roundtrip -S -o - | filecheck %s

;; Regression test for an issue in which roundtripping failed to reproduce the
;; original types because type canonicalization was incorrect when the canonical
;; types already existed in the store.

(module
 (rec
  ;; CHECK:      (rec
  ;; CHECK-NEXT:  (type $A (sub (struct (field (ref $C)))))
  (type $A (sub (struct (field (ref $C)))))

  ;; CHECK:       (type $B (func (param (ref $A)) (result (ref $B))))
  (type $B (func (param (ref $A)) (result (ref $B))))

  ;; CHECK:       (type $C (struct (field (mut (ref $B)))))
  (type $C (struct (field (mut (ref $B)))))

  ;; CHECK:       (type $D (sub $A (struct (field (ref $C)) (field (ref $A)))))
  (type $D (sub $A (struct (field (ref $C)) (field (ref $A)))))
 )

 ;; CHECK:      (func $use-types (type $4) (param $0 (ref $A)) (param $1 (ref $D))
 ;; CHECK-NEXT:  (nop)
 ;; CHECK-NEXT: )
 (func $use-types (param (ref $A) (ref $D))
  (nop)
 )
)