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
9define void @_Z3barv() uwtable optsize ssp personality i32 (...)* @__gxx_personality_v0 {
10entry:
11  invoke void @_Z3quxv() optsize
12          to label %try.cont unwind label %lpad
13
14try.cont:                                         ; preds = %entry, %invoke.cont4
15  ret void
16
17lpad:                                             ; 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
25declare void @_Z3quxv() optsize
26
27declare i32 @__gxx_personality_v0(...)
28
29define void @cleanupret0() personality i32 (...)* @__gxx_personality_v0 {
30entry:
31  invoke void @_Z3quxv() optsize
32          to label %exit unwind label %pad
33pad:
34  %cp = cleanuppad within none [i7 4]
35  cleanupret from %cp unwind to caller
36exit:
37  ret void
38}
39
40; forward ref by name
41define void @cleanupret1() personality i32 (...)* @__gxx_personality_v0 {
42entry:
43  invoke void @_Z3quxv() optsize
44          to label %exit unwind label %pad
45cleanup:
46  cleanupret from %cp unwind label %pad
47pad:
48  %cp = cleanuppad within none []
49  br label %cleanup
50exit:
51  ret void
52}
53
54; forward ref by ID
55define void @cleanupret2() personality i32 (...)* @__gxx_personality_v0 {
56entry:
57  invoke void @_Z3quxv() optsize
58          to label %exit unwind label %pad
59cleanup:
60  cleanupret from %0 unwind label %pad
61pad:
62  %0 = cleanuppad within none []
63  br label %cleanup
64exit:
65  ret void
66}
67
68define void @catchret0() personality i32 (...)* @__gxx_personality_v0 {
69entry:
70  invoke void @_Z3quxv() optsize
71          to label %exit unwind label %pad
72pad:
73  %cs1 = catchswitch within none [label %catch] unwind to caller
74catch:
75  %cp = catchpad within %cs1 [i7 4]
76  catchret from %cp to label %exit
77exit:
78  ret void
79}
80
81; forward ref by name
82define void @catchret1() personality i32 (...)* @__gxx_personality_v0 {
83entry:
84  invoke void @_Z3quxv() optsize
85          to label %exit unwind label %pad
86catchret:
87  catchret from %cp to label %exit
88pad:
89  %cs1 = catchswitch within none [label %catch] unwind to caller
90catch:
91  %cp = catchpad within %cs1 [i7 4]
92  br label %catchret
93exit:
94  ret void
95}
96
97; forward ref by ID
98define void @catchret2() personality i32 (...)* @__gxx_personality_v0 {
99entry:
100  invoke void @_Z3quxv() optsize
101          to label %exit unwind label %pad
102catchret:
103  catchret from %0 to label %exit
104pad:
105  %cs1 = catchswitch within none [label %catch] unwind to caller
106catch:
107  %0 = catchpad within %cs1 [i7 4]
108  br label %catchret
109exit:
110  ret void
111}
112
113define i8 @catchpad() personality i32 (...)* @__gxx_personality_v0 {
114entry:
115  invoke void @_Z3quxv() optsize
116          to label %exit unwind label %bb2
117bb2:
118  %cs1 = catchswitch within none [label %catch] unwind to caller
119catch:
120  catchpad within %cs1 [i7 4]
121  br label %exit
122exit:
123  ret i8 0
124}
125
126define void @cleanuppad() personality i32 (...)* @__gxx_personality_v0 {
127entry:
128  br label %try.cont
129
130try.cont:
131  invoke void @_Z3quxv() optsize
132          to label %try.cont unwind label %bb
133bb:
134  cleanuppad within none [i7 4]
135  ret void
136}
137