blob: 70613347acb453dad37f36dd45c02b050a35e9b3 [file]
;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.
;; RUN: wasm-opt %s -all -S -o - | filecheck %s
;; Regression test for a parser bug where we would incorrectly pop a
;; nullable `ref` operand for an unreachable br_on_cast_desc_eq{_fail} that
;; expected a non-nullable `ref`, then immediately fail the relevant type check.
(module
(rec
;; CHECK: (rec
;; CHECK-NEXT: (type $s (descriptor $d) (struct))
(type $s (descriptor $d) (struct))
;; CHECK: (type $d (describes $s) (struct))
(type $d (describes $s) (struct))
)
;; CHECK: (func $unreachable-br-on-cast-desc (type $2) (result (ref $s))
;; CHECK-NEXT: (block $label (result (ref $s))
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (ref.null none)
;; CHECK-NEXT: )
;; CHECK-NEXT: (block ;; (replaces unreachable BrOn we can't emit)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $unreachable-br-on-cast-desc (result (ref $s))
(br_on_cast_desc_eq 0 (ref $s) (ref $s)
;; The input type is expected to be non-nullable, so this cannot be the
;; input to the cast. We should create a new `unreachable` instead.
(ref.null none)
(unreachable)
)
)
)