xref: /aosp_15_r20/external/llvm/test/Transforms/PruneEH/pr26263.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt -prune-eh -S < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
3*9880d681SAndroid Build Coastguard Workertarget triple = "i386-pc-windows-msvc"
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Workerdeclare void @neverthrows() nounwind
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Workerdefine void @test1() personality i32 (...)* @__CxxFrameHandler3 {
8*9880d681SAndroid Build Coastguard Worker  invoke void @neverthrows()
9*9880d681SAndroid Build Coastguard Worker          to label %try.cont unwind label %cleanuppad
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Workertry.cont:
12*9880d681SAndroid Build Coastguard Worker  ret void
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Workercleanuppad:
15*9880d681SAndroid Build Coastguard Worker  %cp = cleanuppad within none []
16*9880d681SAndroid Build Coastguard Worker  br label %cleanupret
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Workercleanupret:
19*9880d681SAndroid Build Coastguard Worker  cleanupret from %cp unwind to caller
20*9880d681SAndroid Build Coastguard Worker}
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: define void @test1(
23*9880d681SAndroid Build Coastguard Worker; CHECK: call void @neverthrows()
24*9880d681SAndroid Build Coastguard Worker
25*9880d681SAndroid Build Coastguard Worker; CHECK: %[[cp:.*]] = cleanuppad within none []
26*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: unreachable
27*9880d681SAndroid Build Coastguard Worker
28*9880d681SAndroid Build Coastguard Worker; CHECK: cleanupret from %[[cp]] unwind to caller
29*9880d681SAndroid Build Coastguard Worker
30*9880d681SAndroid Build Coastguard Workerdefine void @test2() personality i32 (...)* @__CxxFrameHandler3 {
31*9880d681SAndroid Build Coastguard Worker  invoke void @neverthrows()
32*9880d681SAndroid Build Coastguard Worker          to label %try.cont unwind label %catchswitch
33*9880d681SAndroid Build Coastguard Worker
34*9880d681SAndroid Build Coastguard Workertry.cont:
35*9880d681SAndroid Build Coastguard Worker  ret void
36*9880d681SAndroid Build Coastguard Worker
37*9880d681SAndroid Build Coastguard Workercatchswitch:
38*9880d681SAndroid Build Coastguard Worker  %cs = catchswitch within none [label %catchpad] unwind to caller
39*9880d681SAndroid Build Coastguard Worker
40*9880d681SAndroid Build Coastguard Workercatchpad:
41*9880d681SAndroid Build Coastguard Worker  %cp = catchpad within %cs []
42*9880d681SAndroid Build Coastguard Worker  unreachable
43*9880d681SAndroid Build Coastguard Worker
44*9880d681SAndroid Build Coastguard Workerret:
45*9880d681SAndroid Build Coastguard Worker  ret void
46*9880d681SAndroid Build Coastguard Worker}
47*9880d681SAndroid Build Coastguard Worker
48*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: define void @test2(
49*9880d681SAndroid Build Coastguard Worker; CHECK: call void @neverthrows()
50*9880d681SAndroid Build Coastguard Worker
51*9880d681SAndroid Build Coastguard Worker; CHECK: %[[cs:.*]] = catchswitch within none [label
52*9880d681SAndroid Build Coastguard Worker
53*9880d681SAndroid Build Coastguard Worker; CHECK: catchpad within %[[cs]] []
54*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: unreachable
55*9880d681SAndroid Build Coastguard Worker
56*9880d681SAndroid Build Coastguard Workerdeclare i32 @__CxxFrameHandler3(...)
57