1 ; RUN: sed -e s/.T1:// %s | not llvm-as -disable-output 2>&1 | FileCheck --check-prefix=CHECK1 %s
2 ; RUN: sed -e s/.T2:// %s | not llvm-as -disable-output 2>&1 | FileCheck --check-prefix=CHECK2 %s
3 ; RUN: sed -e s/.T3:// %s | not llvm-as -disable-output 2>&1 | FileCheck --check-prefix=CHECK3 %s
4 ; RUN: sed -e s/.T4:// %s | not llvm-as -disable-output 2>&1 | FileCheck --check-prefix=CHECK4 %s
5 ; RUN: sed -e s/.T5:// %s | not opt -verify -disable-output 2>&1 | FileCheck --check-prefix=CHECK5 %s
6 ; RUN: sed -e s/.T6:// %s | not opt -verify -disable-output 2>&1 | FileCheck --check-prefix=CHECK6 %s
7 ; RUN: sed -e s/.T7:// %s | not opt -verify -disable-output 2>&1 | FileCheck --check-prefix=CHECK7 %s
8 ; RUN: sed -e s/.T8:// %s | not opt -verify -disable-output 2>&1 | FileCheck --check-prefix=CHECK8 %s
9 ; RUN: sed -e s/.T9:// %s | not opt -verify -disable-output 2>&1 | FileCheck --check-prefix=CHECK9 %s
10 ; RUN: sed -e s/.T10:// %s | not opt -verify -disable-output 2>&1 | FileCheck --check-prefix=CHECK10 %s
11 ; RUN: sed -e s/.T11:// %s | not opt -verify -disable-output 2>&1 | FileCheck --check-prefix=CHECK11 %s
12 ; RUN: sed -e s/.T12:// %s | not opt -verify -disable-output 2>&1 | FileCheck --check-prefix=CHECK12 %s
13 ; RUN: sed -e s/.T13:// %s | not opt -verify -disable-output 2>&1 | FileCheck --check-prefix=CHECK13 %s
17 ;T1: define void @f() {
19 ;T1: catchret from undef to label %next
20 ;T1: ; CHECK1: CatchReturnInst needs to be provided a CatchPad
25 ;T2: define void @f() {
27 ;T2: %x = cleanuppad within none []
28 ;T2: ; catchret's first operand's operator must be catchpad
29 ;T2: catchret from %x to label %entry
30 ;T2: ; CHECK2: CatchReturnInst needs to be provided a CatchPad
33 ;T3: define void @f() {
35 ;T3: cleanupret from undef unwind label %next
36 ;T3: ; CHECK3: CleanupReturnInst needs to be provided a CleanupPad
41 ;T4: define void @f() {
43 ;T4: %cs = catchswitch within none [label %next] unwind to caller
45 ;T4: %x = catchpad within %cs []
46 ;T4: ; cleanupret first operand's operator must be cleanuppad
47 ;T4: cleanupret from %x unwind to caller
48 ;T4: ; CHECK4: CleanupReturnInst needs to be provided a CleanupPad
51 ;T5: define void @f() personality void ()* @g {
55 ;T5: %cs = catchswitch within none [label %catch] unwind to caller
57 ;T5: catchpad within %cs []
60 ;T5: cleanuppad within %cs []
61 ;T5: ; CHECK5: CleanupPadInst has an invalid parent
65 ;T6: define void @f() personality void ()* @g {
69 ;T6: %cs1 = catchswitch within none [label %catch1] unwind label %catch2
70 ;T6: ; CHECK6: Block containg CatchPadInst must be jumped to only by its catchswitch
72 ;T6: catchpad within %cs1 []
75 ;T6: %cs2 = catchswitch within none [label %catch2] unwind to caller
77 ;T6: catchpad within %cs2 []
81 ;T7: define void @f() personality void ()* @g {
85 ;T7: %cs1 = catchswitch within none [label %catch1] unwind to caller
87 ;T7: catchpad within %cs1 []
90 ;T7: %cs2 = catchswitch within %cs1 [label %catch2] unwind to caller
91 ;T7: ; CHECK7: CatchSwitchInst has an invalid parent
93 ;T7: catchpad within %cs2 []
97 ;T8: define void @f() personality void ()* @g {
101 ;T8: %cs1 = catchswitch within none [ label %switch1 ] unwind to caller
102 ;T8: ; CHECK8: CatchSwitchInst handlers must be catchpads
105 ;T9: define void @f() personality void ()* @g {
109 ;T9: %cp = cleanuppad within none []
110 ;T9: invoke void @g() [ "funclet"(token %cp) ]
111 ;T9: to label %exit unwind label %cleanup
112 ;T9: ; CHECK9: EH pad cannot handle exceptions raised within it
113 ;T9: ; CHECK9-NEXT: %cp = cleanuppad within none []
114 ;T9: ; CHECK9-NEXT: invoke void @g() [ "funclet"(token %cp) ]
119 ;T10: define void @f() personality void ()* @g {
123 ;T10: %cp1 = cleanuppad within none []
126 ;T10: %cs = catchswitch within %cp1 [label %catch] unwind to caller
128 ;T10: %catchp1 = catchpad within %cs [i32 1]
131 ;T10: %cp2 = cleanuppad within %catchp1 []
134 ;T10: %cp3 = cleanuppad within %cp2 []
135 ;T10: cleanupret from %cp3 unwind label %switch
136 ;T10: ; CHECK10: EH pad cannot handle exceptions raised within it
137 ;T10: ; CHECK10-NEXT: %cs = catchswitch within %cp1 [label %catch] unwind to caller
138 ;T10: ; CHECK10-NEXT: cleanupret from %cp3 unwind label %switch
141 ;T11: define void @f() personality void ()* @g {
145 ;T11: %cp1 = cleanuppad within none []
148 ;T11: %cp2 = cleanuppad within %cp1 []
151 ;T11: %cs = catchswitch within none [label %catch] unwind label %cleanup2
152 ;T11: ; CHECK11: A single unwind edge may only enter one EH pad
153 ;T11: ; CHECK11-NEXT: %cs = catchswitch within none [label %catch] unwind label %cleanup2
155 ;T11: catchpad within %cs [i32 1]
159 ;T12: define void @f() personality void ()* @g {
163 ;T12: %cp = cleanuppad within none []
164 ;T12: cleanupret from %cp unwind label %switch
165 ;T12: ; CHECK12: A cleanupret must exit its cleanup
166 ;T12: ; CHECK12-NEXT: cleanupret from %cp unwind label %switch
168 ;T12: %cs = catchswitch within %cp [label %catch] unwind to caller
170 ;T12: catchpad within %cs [i32 1]
174 ;T13: define void @f() personality void ()* @g {
178 ;T13: %cs = catchswitch within none [label %catch] unwind label %switch
179 ;T13: ; CHECK13: EH pad cannot handle exceptions raised within it
180 ;T13: ; CHECK13-NEXT: %cs = catchswitch within none [label %catch] unwind label %switch
182 ;T13: catchpad within %cs [i32 0]