xref: /aosp_15_r20/external/llvm/test/Transforms/SimplifyCFG/merge-cleanuppads.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt -S -simplifycfg < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
3*9880d681SAndroid Build Coastguard Workertarget triple = "x86_64-pc-windows-msvc18.0.0"
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Worker; Function Attrs: uwtable
6*9880d681SAndroid Build Coastguard Workerdefine void @test1() #0 personality i32 (...)* @__CxxFrameHandler3 {
7*9880d681SAndroid Build Coastguard Workerentry:
8*9880d681SAndroid Build Coastguard Worker  invoke void @may_throw(i32 3)
9*9880d681SAndroid Build Coastguard Worker          to label %invoke.cont unwind label %ehcleanup
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Workerinvoke.cont:                                      ; preds = %entry
12*9880d681SAndroid Build Coastguard Worker  tail call void @may_throw(i32 2) #2
13*9880d681SAndroid Build Coastguard Worker  tail call void @may_throw(i32 1) #2
14*9880d681SAndroid Build Coastguard Worker  ret void
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Workerehcleanup:                                        ; preds = %entry
17*9880d681SAndroid Build Coastguard Worker  %cp = cleanuppad within none []
18*9880d681SAndroid Build Coastguard Worker  tail call void @may_throw(i32 2) #2 [ "funclet"(token %cp) ]
19*9880d681SAndroid Build Coastguard Worker  cleanupret from %cp unwind label %ehcleanup2
20*9880d681SAndroid Build Coastguard Worker
21*9880d681SAndroid Build Coastguard Workerehcleanup2:
22*9880d681SAndroid Build Coastguard Worker  %cp2 = cleanuppad within none []
23*9880d681SAndroid Build Coastguard Worker  tail call void @may_throw(i32 1) #2 [ "funclet"(token %cp2) ]
24*9880d681SAndroid Build Coastguard Worker  cleanupret from %cp2 unwind to caller
25*9880d681SAndroid Build Coastguard Worker}
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: define void @test1(
28*9880d681SAndroid Build Coastguard Worker; CHECK: %[[cp:.*]] = cleanuppad within none []
29*9880d681SAndroid Build Coastguard Worker; CHECK: tail call void @may_throw(i32 2) #2 [ "funclet"(token %[[cp]]) ]
30*9880d681SAndroid Build Coastguard Worker; CHECK: tail call void @may_throw(i32 1) #2 [ "funclet"(token %[[cp]]) ]
31*9880d681SAndroid Build Coastguard Worker; CHECK: cleanupret from %[[cp]] unwind to caller
32*9880d681SAndroid Build Coastguard Worker
33*9880d681SAndroid Build Coastguard Workerdeclare void @may_throw(i32) #1
34*9880d681SAndroid Build Coastguard Worker
35*9880d681SAndroid Build Coastguard Workerdeclare i32 @__CxxFrameHandler3(...)
36*9880d681SAndroid Build Coastguard Worker
37*9880d681SAndroid Build Coastguard Workerattributes #0 = { uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
38*9880d681SAndroid Build Coastguard Workerattributes #1 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
39*9880d681SAndroid Build Coastguard Workerattributes #2 = { nounwind }
40