xref: /aosp_15_r20/external/llvm/test/Transforms/Inline/pr26698.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt -S -inline < %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 = "i686-pc-windows-msvc18.0.0"
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Workerdeclare void @g(i32)
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Workerdefine void @f() personality i32 (...)* @__CxxFrameHandler3 {
8*9880d681SAndroid Build Coastguard Workerentry:
9*9880d681SAndroid Build Coastguard Worker  invoke void @g(i32 0)
10*9880d681SAndroid Build Coastguard Worker          to label %invoke.cont unwind label %cs.bb
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard Workerinvoke.cont:
13*9880d681SAndroid Build Coastguard Worker  ret void
14*9880d681SAndroid Build Coastguard Worker
15*9880d681SAndroid Build Coastguard Workercs.bb:
16*9880d681SAndroid Build Coastguard Worker  %cs = catchswitch within none [label %cp.bb] unwind label %cleanup.bb
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Workercp.bb:
19*9880d681SAndroid Build Coastguard Worker  %cpouter1 = catchpad within %cs [i8* null, i32 0, i8* null]
20*9880d681SAndroid Build Coastguard Worker  call void @dtor() #1 [ "funclet"(token %cpouter1) ]
21*9880d681SAndroid Build Coastguard Worker  catchret from %cpouter1 to label %invoke.cont
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Workercleanup.bb:
24*9880d681SAndroid Build Coastguard Worker  %cpouter2 = cleanuppad within none []
25*9880d681SAndroid Build Coastguard Worker  call void @g(i32 1) [ "funclet"(token %cpouter2) ]
26*9880d681SAndroid Build Coastguard Worker  cleanupret from %cpouter2 unwind to caller
27*9880d681SAndroid Build Coastguard Worker}
28*9880d681SAndroid Build Coastguard Worker
29*9880d681SAndroid Build Coastguard Workerdeclare i32 @__CxxFrameHandler3(...)
30*9880d681SAndroid Build Coastguard Worker
31*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind
32*9880d681SAndroid Build Coastguard Workerdefine internal void @dtor() #1 personality i32 (...)* @__CxxFrameHandler3 {
33*9880d681SAndroid Build Coastguard Workerentry:
34*9880d681SAndroid Build Coastguard Worker  invoke void @g(i32 2)
35*9880d681SAndroid Build Coastguard Worker          to label %invoke.cont unwind label %ehcleanup1
36*9880d681SAndroid Build Coastguard Worker
37*9880d681SAndroid Build Coastguard Workerinvoke.cont:
38*9880d681SAndroid Build Coastguard Worker  ret void
39*9880d681SAndroid Build Coastguard Worker
40*9880d681SAndroid Build Coastguard Workerehcleanup1:
41*9880d681SAndroid Build Coastguard Worker  %cpinner1 = cleanuppad within none []
42*9880d681SAndroid Build Coastguard Worker  invoke void @g(i32 3) [ "funclet" (token %cpinner1) ]
43*9880d681SAndroid Build Coastguard Worker          to label %done unwind label %ehcleanup2
44*9880d681SAndroid Build Coastguard Workerdone:
45*9880d681SAndroid Build Coastguard Worker  unreachable
46*9880d681SAndroid Build Coastguard Worker
47*9880d681SAndroid Build Coastguard Workerehcleanup2:
48*9880d681SAndroid Build Coastguard Worker  %cpinner2 = cleanuppad within %cpinner1 []
49*9880d681SAndroid Build Coastguard Worker  call void @g(i32 4) [ "funclet" (token %cpinner2) ]
50*9880d681SAndroid Build Coastguard Worker  cleanupret from %cpinner2 unwind to caller
51*9880d681SAndroid Build Coastguard Worker}
52*9880d681SAndroid Build Coastguard Worker
53*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: define void @f(
54*9880d681SAndroid Build Coastguard Worker
55*9880d681SAndroid Build Coastguard Worker; CHECK:      %[[cs:.*]] = catchswitch within none
56*9880d681SAndroid Build Coastguard Worker
57*9880d681SAndroid Build Coastguard Worker; CHECK:      %[[cpouter1:.*]] = catchpad within %[[cs]]
58*9880d681SAndroid Build Coastguard Worker
59*9880d681SAndroid Build Coastguard Worker; CHECK:      %[[cpinner1:.*]] = cleanuppad within %[[cpouter1]]
60*9880d681SAndroid Build Coastguard Worker
61*9880d681SAndroid Build Coastguard Worker; CHECK:      %[[cpinner2:.*]] = cleanuppad within %[[cpinner1]]
62*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: call void @g(i32 4) #0 [ "funclet"(token %[[cpinner2]]) ]
63*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: unreachable
64*9880d681SAndroid Build Coastguard Worker
65*9880d681SAndroid Build Coastguard Workerattributes #1 = { nounwind }
66