blob: acdeb796ac19321468d3b814f751ab8f0b25efd5 [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:
18 %catch = catchpad [i32 1] to label %do_catch unwind label %catchend
19do_catch:
20 %exn = call i8* @llvm.eh.exceptionpointer.p0i8(token %catch)
21 call void (...) @f(i8* %exn)
22 catchret %catch to label %exit
23catchend:
24 catchendpad unwind to caller
25exit:
26 ret void
27}
28
29define void @test2() personality i32 (...)* @ProcessManagedException {
30entry:
31 invoke void (...) @f(i32 1)
32 to label %exit unwind label %catchpad
33catchpad:
34 %catch = catchpad [i32 1] to label %do_catch unwind label %catchend
35do_catch:
36 %exn = call i8 addrspace(1)* @llvm.eh.exceptionpointer.p1i8(token %catch)
37 call void (...) @f(i8 addrspace(1)* %exn)
38 catchret %catch to label %exit
39catchend:
40 catchendpad unwind to caller
41exit:
42 ret void
43}
44
45declare i32 @__CxxFrameHandler3(...)
46declare i32 @ProcessManagedException(...)