blob: 3658792a384361cee5aa442e151bd0e73d5dff88 [file] [log] [blame]
Joseph Tremoulet61efbc32015-09-03 09:15:32 +00001; RUN: opt -lint -disable-output < %s
2
3; This test is meant to prove that the verifier does not report errors for correct
4; use of the llvm.eh.exceptionpointer intrinsic.
5
6target triple = "x86_64-pc-windows-msvc"
7
8declare i8* @llvm.eh.exceptionpointer.p0i8(token)
9declare i8 addrspace(1)* @llvm.eh.exceptionpointer.p1i8(token)
10
11declare void @f(...)
12
13define void @test1() personality i32 (...)* @__CxxFrameHandler3 {
14entry:
15 invoke void (...) @f(i32 1)
16 to label %exit unwind label %catchpad
17catchpad:
David Majnemer8a1c45d2015-12-12 05:38:55 +000018 %cs1 = catchswitch within none [label %do_catch] unwind to caller
Joseph Tremoulet61efbc32015-09-03 09:15:32 +000019do_catch:
David Majnemer8a1c45d2015-12-12 05:38:55 +000020 %catch = catchpad within %cs1 [i32 1]
Joseph Tremoulet61efbc32015-09-03 09:15:32 +000021 %exn = call i8* @llvm.eh.exceptionpointer.p0i8(token %catch)
22 call void (...) @f(i8* %exn)
David Majnemer8a1c45d2015-12-12 05:38:55 +000023 catchret from %catch to label %exit
Joseph Tremoulet61efbc32015-09-03 09:15:32 +000024exit:
25 ret void
26}
27
28define void @test2() personality i32 (...)* @ProcessManagedException {
29entry:
30 invoke void (...) @f(i32 1)
31 to label %exit unwind label %catchpad
32catchpad:
David Majnemer8a1c45d2015-12-12 05:38:55 +000033 %cs1 = catchswitch within none [label %do_catch] unwind to caller
Joseph Tremoulet61efbc32015-09-03 09:15:32 +000034do_catch:
David Majnemer8a1c45d2015-12-12 05:38:55 +000035 %catch = catchpad within %cs1 [i32 1]
Joseph Tremoulet61efbc32015-09-03 09:15:32 +000036 %exn = call i8 addrspace(1)* @llvm.eh.exceptionpointer.p1i8(token %catch)
37 call void (...) @f(i8 addrspace(1)* %exn)
David Majnemer8a1c45d2015-12-12 05:38:55 +000038 catchret from %catch to label %exit
Joseph Tremoulet61efbc32015-09-03 09:15:32 +000039exit:
40 ret void
41}
42
43declare i32 @__CxxFrameHandler3(...)
44declare i32 @ProcessManagedException(...)