[IR] Give catchret an optional 'return value' operand
[oota-llvm.git] / test / Feature / exception.ll
1 ; RUN: llvm-as < %s | llvm-dis > %t1.ll
2 ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
3 ; RUN: diff %t1.ll %t2.ll
4
5 @_ZTIc = external constant i8*
6 @_ZTId = external constant i8*
7 @_ZTIPKc = external constant i8*
8
9 define void @_Z3barv() uwtable optsize ssp personality i32 (...)* @__gxx_personality_v0 {
10 entry:
11   invoke void @_Z3quxv() optsize
12           to label %try.cont unwind label %lpad
13
14 try.cont:                                         ; preds = %entry, %invoke.cont4
15   ret void
16
17 lpad:                                             ; preds = %entry
18   %exn = landingpad {i8*, i32}
19             cleanup
20             catch i8** @_ZTIc
21             filter [2 x i8**] [i8** @_ZTIPKc, i8** @_ZTId]
22   resume { i8*, i32 } %exn
23 }
24
25 declare void @_Z3quxv() optsize
26
27 declare i32 @__gxx_personality_v0(...)
28
29 define void @cleanupret0() personality i32 (...)* @__gxx_personality_v0 {
30 entry:
31   br label %try.cont
32
33 try.cont:
34   invoke void @_Z3quxv() optsize
35           to label %try.cont unwind label %bb
36 bb:
37   cleanuppad void [i7 4]
38   cleanupret i8 0 unwind label %bb
39 }
40
41 define void @cleanupret1() personality i32 (...)* @__gxx_personality_v0 {
42 entry:
43   br label %try.cont
44
45 try.cont:
46   invoke void @_Z3quxv() optsize
47           to label %try.cont unwind label %bb
48 bb:
49   cleanuppad void [i7 4]
50   cleanupret void unwind label %bb
51 }
52
53 define void @cleanupret2() personality i32 (...)* @__gxx_personality_v0 {
54 entry:
55   cleanupret i8 0 unwind to caller
56 }
57
58 define void @cleanupret3() personality i32 (...)* @__gxx_personality_v0 {
59   cleanupret void unwind to caller
60 }
61
62 define void @catchret() personality i32 (...)* @__gxx_personality_v0 {
63 entry:
64   br label %bb
65 bb:
66   catchret void to label %bb
67 }
68
69 define i8 @catchpad() personality i32 (...)* @__gxx_personality_v0 {
70 entry:
71   br label %try.cont
72
73 try.cont:
74   invoke void @_Z3quxv() optsize
75           to label %exit unwind label %bb2
76 bb:
77   catchret token %cbv to label %exit
78
79 exit:
80   ret i8 0
81 bb2:
82   %cbv = catchpad token [i7 4] to label %bb unwind label %bb3
83 bb3:
84   catchendpad unwind to caller
85 }
86
87 define void @terminatepad0() personality i32 (...)* @__gxx_personality_v0 {
88 entry:
89   br label %try.cont
90
91 try.cont:
92   invoke void @_Z3quxv() optsize
93           to label %try.cont unwind label %bb
94 bb:
95   terminatepad [i7 4] unwind label %bb
96 }
97
98 define void @terminatepad1() personality i32 (...)* @__gxx_personality_v0 {
99 entry:
100   br label %try.cont
101
102 try.cont:
103   invoke void @_Z3quxv() optsize
104           to label %try.cont unwind label %bb
105 bb:
106   terminatepad [i7 4] unwind to caller
107 }
108
109 define void @cleanuppad() personality i32 (...)* @__gxx_personality_v0 {
110 entry:
111   br label %try.cont
112
113 try.cont:
114   invoke void @_Z3quxv() optsize
115           to label %try.cont unwind label %bb
116 bb:
117   cleanuppad void [i7 4]
118   ret void
119 }
120
121 define void @catchendpad0() personality i32 (...)* @__gxx_personality_v0 {
122 entry:
123   br label %try.cont
124
125 try.cont:
126   invoke void @_Z3quxv() optsize
127           to label %try.cont unwind label %bb
128 bb:
129   catchendpad unwind label %bb
130 }
131
132 define void @catchendpad1() personality i32 (...)* @__gxx_personality_v0 {
133 entry:
134   br label %try.cont
135
136 try.cont:
137   invoke void @_Z3quxv() optsize
138           to label %try.cont unwind label %bb
139 bb:
140   catchendpad unwind to caller
141 }