Skip to content

Commit 8bebd6b

Browse files
committed
test
1 parent 10d80a7 commit 8bebd6b

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

test/lit/passes/gsi-desc.wast

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,3 +342,38 @@
342342
)
343343
)
344344

345+
;; Two descriptor instances in globals.
346+
(module
347+
(rec
348+
;; CHECK: (rec
349+
;; CHECK-NEXT: (type $A (sub (descriptor $A.desc (struct))))
350+
(type $A (sub (descriptor $A.desc (struct))))
351+
;; CHECK: (type $A.desc (sub (describes $A (struct))))
352+
(type $A.desc (sub (describes $A (struct))))
353+
)
354+
355+
;; CHECK: (type $2 (func (param anyref)))
356+
357+
;; CHECK: (global $A.desc (ref $A.desc) (struct.new_default $A.desc))
358+
(global $A.desc (ref $A.desc) (struct.new $A.desc))
359+
360+
;; CHECK: (global $A.desc2 (ref $A.desc) (struct.new_default $A.desc))
361+
(global $A.desc2 (ref $A.desc) (struct.new $A.desc))
362+
363+
;; CHECK: (func $test (type $2) (param $any anyref)
364+
;; CHECK-NEXT: (drop
365+
;; CHECK-NEXT: (ref.cast (ref $A)
366+
;; CHECK-NEXT: (local.get $any)
367+
;; CHECK-NEXT: )
368+
;; CHECK-NEXT: )
369+
;; CHECK-NEXT: )
370+
(func $test (param $any anyref)
371+
;; We do not optimize here. TODO: we could with a select
372+
(drop
373+
(ref.cast (ref $A)
374+
(local.get $any)
375+
)
376+
)
377+
)
378+
)
379+

0 commit comments

Comments
 (0)