blob: 12c1a259520ffd76446b84e7c87d7081ddb5f74d [file] [log] [blame]
Chandler Carruth49589f02012-07-02 18:37:59 +00001; RUN: not llvm-as < %s -o /dev/null 2>&1 | FileCheck %s
Nuno Lopes917f97c2012-06-28 22:57:00 +00002
3; PR1042
4define i32 @foo() {
David Majnemer4a45f082015-07-31 17:58:14 +00005; CHECK: The unwind destination does not have an exception handling instruction
Nuno Lopes917f97c2012-06-28 22:57:00 +00006 %A = invoke i32 @foo( )
7 to label %L unwind label %L ; <i32> [#uses=1]
8L: ; preds = %0, %0
9 ret i32 %A
10}
11
12; PR1042
13define i32 @bar() {
14 br i1 false, label %L1, label %L2
15L1: ; preds = %0
16 %A = invoke i32 @bar( )
17 to label %L unwind label %L ; <i32> [#uses=1]
18L2: ; preds = %0
19 br label %L
20L: ; preds = %L2, %L1, %L1
David Majnemer4a45f082015-07-31 17:58:14 +000021; CHECK: The unwind destination does not have an exception handling instruction
Nuno Lopes917f97c2012-06-28 22:57:00 +000022 ret i32 %A
23}
24
25
26declare i32 @__gxx_personality_v0(...)
27declare void @llvm.donothing()
28declare void @llvm.trap()
29declare i8 @llvm.expect.i8(i8,i8)
30declare i32 @fn(i8 (i8, i8)*)
31
David Majnemercc714e22015-06-17 20:52:32 +000032define void @f1() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
Nuno Lopes917f97c2012-06-28 22:57:00 +000033entry:
34; OK
35 invoke void @llvm.donothing()
Eli Friedman6b951b22012-08-10 20:55:20 +000036 to label %conta unwind label %contb
Nuno Lopes917f97c2012-06-28 22:57:00 +000037
Eli Friedman6b951b22012-08-10 20:55:20 +000038conta:
39 ret void
40
41contb:
David Majnemercc714e22015-06-17 20:52:32 +000042 %0 = landingpad { i8*, i32 }
Nuno Lopes917f97c2012-06-28 22:57:00 +000043 filter [0 x i8*] zeroinitializer
44 ret void
45}
46
David Majnemercc714e22015-06-17 20:52:32 +000047define i8 @f2() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
Nuno Lopes917f97c2012-06-28 22:57:00 +000048entry:
David Majnemer5964d132016-08-04 20:30:07 +000049; CHECK: Cannot invoke an intrinsic other than donothing, patchpoint, statepoint, coro_resume or coro_destroy
Nuno Lopes917f97c2012-06-28 22:57:00 +000050 invoke void @llvm.trap()
51 to label %cont unwind label %lpad
52
53cont:
54 ret i8 3
55
56lpad:
David Majnemercc714e22015-06-17 20:52:32 +000057 %0 = landingpad { i8*, i32 }
Nuno Lopes917f97c2012-06-28 22:57:00 +000058 filter [0 x i8*] zeroinitializer
59 ret i8 2
60}
61
62define i32 @f3() {
63entry:
64; CHECK: Cannot take the address of an intrinsic
65 %call = call i32 @fn(i8 (i8, i8)* @llvm.expect.i8)
66 ret i32 %call
67}
Eli Friedman6b951b22012-08-10 20:55:20 +000068
David Majnemercc714e22015-06-17 20:52:32 +000069define void @f4() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
Eli Friedman6b951b22012-08-10 20:55:20 +000070entry:
71 invoke void @llvm.donothing()
72 to label %cont unwind label %cont
73
74cont:
75; CHECK: Block containing LandingPadInst must be jumped to only by the unwind edge of an invoke.
David Majnemercc714e22015-06-17 20:52:32 +000076 %0 = landingpad { i8*, i32 }
Eli Friedman6b951b22012-08-10 20:55:20 +000077 filter [0 x i8*] zeroinitializer
78 ret void
79}