blob: be6e50e52703e819e3f6f81e104cc0744ea79669 [file] [edit]
;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
;; RUN: wasm-opt -all --precompute --roundtrip --roundtrip %s -S -o - | filecheck %s
;; After precompute, the If's hint gets attached to a nop. The roundtrips should
;; not error on branch hint parsing errors (the tuple here affects parsing in a
;; way that causes an error if we get anything wrong). We need to use precompute
;; here as a way to get a branch hint onto a non-branch - the text parser just
;; skips non-branches currently.
(module
;; CHECK: (type $0 (func (result i32 i32)))
;; CHECK: (type $func (func))
(type $func (func))
;; CHECK: (tag $tag (type $func))
(tag $tag (type $func))
;; CHECK: (func $test (type $0) (result i32 i32)
;; CHECK-NEXT: (try (type $0) (result i32 i32)
;; CHECK-NEXT: (do
;; CHECK-NEXT: (tuple.make 2
;; CHECK-NEXT: (i32.const 0)
;; CHECK-NEXT: (i32.const 1)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (catch $tag
;; CHECK-NEXT: (@metadata.code.branch_hint "\01")
;; CHECK-NEXT: (nop)
;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $test (result i32 i32)
(try (result i32 i32)
(do
(tuple.make 2
(i32.const 0)
(i32.const 1)
)
)
(catch $tag
(@metadata.code.branch_hint "\01")
(if
(i32.const 0)
(then
(nop)
)
(else
(nop)
)
)
(unreachable)
)
)
)
)