xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/catchpad-weight.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=x86-64 -print-machineinstrs=expand-isel-pseudos %s -o /dev/null 2>&1 | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; Check if the edge weight to the catchpad is calculated correctly.
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Worker; CHECK: Successors according to CFG: BB#2(0x7ffff100 / 0x80000000 = 100.00%) BB#1(0x00000800 / 0x80000000 = 0.00%) BB#3(0x00000400 / 0x80000000 = 0.00%) BB#4(0x00000200 / 0x80000000 = 0.00%) BB#5(0x00000100 / 0x80000000 = 0.00%)
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
8*9880d681SAndroid Build Coastguard Workertarget triple = "x86_64--windows-msvc18.0.0"
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Worker%rtti.TypeDescriptor7 = type { i8**, i8*, [8 x i8] }
11*9880d681SAndroid Build Coastguard Worker%struct.HasDtor = type { i8 }
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Worker$"\01??_R0?AUA@@@8" = comdat any
14*9880d681SAndroid Build Coastguard Worker
15*9880d681SAndroid Build Coastguard Worker$"\01??_R0?AUB@@@8" = comdat any
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Worker$"\01??_R0?AUC@@@8" = comdat any
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Worker@"\01??_7type_info@@6B@" = external constant i8*
20*9880d681SAndroid Build Coastguard Worker@"\01??_R0?AUA@@@8" = linkonce_odr global %rtti.TypeDescriptor7 { i8** @"\01??_7type_info@@6B@", i8* null, [8 x i8] c".?AUA@@\00" }, comdat
21*9880d681SAndroid Build Coastguard Worker@"\01??_R0?AUB@@@8" = linkonce_odr global %rtti.TypeDescriptor7 { i8** @"\01??_7type_info@@6B@", i8* null, [8 x i8] c".?AUB@@\00" }, comdat
22*9880d681SAndroid Build Coastguard Worker@"\01??_R0?AUC@@@8" = linkonce_odr global %rtti.TypeDescriptor7 { i8** @"\01??_7type_info@@6B@", i8* null, [8 x i8] c".?AUC@@\00" }, comdat
23*9880d681SAndroid Build Coastguard Worker
24*9880d681SAndroid Build Coastguard Worker; Function Attrs: uwtable
25*9880d681SAndroid Build Coastguard Workerdefine i32 @main() #0 personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
26*9880d681SAndroid Build Coastguard Workerentry:
27*9880d681SAndroid Build Coastguard Worker  %o = alloca %struct.HasDtor, align 1
28*9880d681SAndroid Build Coastguard Worker  %0 = getelementptr inbounds %struct.HasDtor, %struct.HasDtor* %o, i64 0, i32 0
29*9880d681SAndroid Build Coastguard Worker  call void @llvm.lifetime.start(i64 1, i8* %0) #4
30*9880d681SAndroid Build Coastguard Worker  invoke void @"\01?may_throw@@YAXXZ"()
31*9880d681SAndroid Build Coastguard Worker          to label %try.cont unwind label %catch.dispatch
32*9880d681SAndroid Build Coastguard Worker
33*9880d681SAndroid Build Coastguard Workercatch.dispatch:                                   ; preds = %entry
34*9880d681SAndroid Build Coastguard Worker  %cs1 = catchswitch within none [label %catch.5] unwind label %catch.dispatch.1
35*9880d681SAndroid Build Coastguard Worker
36*9880d681SAndroid Build Coastguard Workercatch.5:                                          ; preds = %catch.dispatch
37*9880d681SAndroid Build Coastguard Worker  %1 = catchpad within %cs1 [%rtti.TypeDescriptor7* @"\01??_R0?AUA@@@8", i32 0, i8* null]
38*9880d681SAndroid Build Coastguard Worker  catchret from %1 to label %try.cont
39*9880d681SAndroid Build Coastguard Worker
40*9880d681SAndroid Build Coastguard Workertry.cont:                                         ; preds = %entry, %catch, %catch.3, %catch.5
41*9880d681SAndroid Build Coastguard Worker  call void @"\01??1HasDtor@@QEAA@XZ"(%struct.HasDtor* nonnull %o) #4
42*9880d681SAndroid Build Coastguard Worker  call void @llvm.lifetime.end(i64 1, i8* %0) #4
43*9880d681SAndroid Build Coastguard Worker  ret i32 0
44*9880d681SAndroid Build Coastguard Worker
45*9880d681SAndroid Build Coastguard Workercatch.dispatch.1:                                 ; preds = %catch.dispatch
46*9880d681SAndroid Build Coastguard Worker  %cs2 = catchswitch within none [label %catch.3] unwind label %catch.dispatch.2
47*9880d681SAndroid Build Coastguard Worker
48*9880d681SAndroid Build Coastguard Workercatch.3:                                          ; preds = %catch.dispatch.1
49*9880d681SAndroid Build Coastguard Worker  %2 = catchpad within %cs2 [%rtti.TypeDescriptor7* @"\01??_R0?AUB@@@8", i32 0, i8* null]
50*9880d681SAndroid Build Coastguard Worker  catchret from %2 to label %try.cont
51*9880d681SAndroid Build Coastguard Worker
52*9880d681SAndroid Build Coastguard Workercatch.dispatch.2:                                 ; preds = %catch.dispatch.1
53*9880d681SAndroid Build Coastguard Worker  %cs3 = catchswitch within none [label %catch] unwind label %ehcleanup
54*9880d681SAndroid Build Coastguard Worker
55*9880d681SAndroid Build Coastguard Workercatch:                                            ; preds = %catch.dispatch.2
56*9880d681SAndroid Build Coastguard Worker  %3 = catchpad within %cs3 [%rtti.TypeDescriptor7* @"\01??_R0?AUC@@@8", i32 0, i8* null]
57*9880d681SAndroid Build Coastguard Worker  catchret from %3 to label %try.cont
58*9880d681SAndroid Build Coastguard Worker
59*9880d681SAndroid Build Coastguard Workerehcleanup:                                        ; preds = %catchendblock
60*9880d681SAndroid Build Coastguard Worker  %4 = cleanuppad within none []
61*9880d681SAndroid Build Coastguard Worker  call void @"\01??1HasDtor@@QEAA@XZ"(%struct.HasDtor* nonnull %o) #4 [ "funclet"(token %4) ]
62*9880d681SAndroid Build Coastguard Worker  cleanupret from %4 unwind to caller
63*9880d681SAndroid Build Coastguard Worker}
64*9880d681SAndroid Build Coastguard Worker
65*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind argmemonly
66*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.lifetime.start(i64, i8* nocapture) #1
67*9880d681SAndroid Build Coastguard Worker
68*9880d681SAndroid Build Coastguard Workerdeclare void @"\01?may_throw@@YAXXZ"() #2
69*9880d681SAndroid Build Coastguard Worker
70*9880d681SAndroid Build Coastguard Workerdeclare i32 @__CxxFrameHandler3(...)
71*9880d681SAndroid Build Coastguard Worker
72*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind
73*9880d681SAndroid Build Coastguard Workerdeclare void @"\01??1HasDtor@@QEAA@XZ"(%struct.HasDtor*) #3
74*9880d681SAndroid Build Coastguard Worker
75*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind argmemonly
76*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.lifetime.end(i64, i8* nocapture) #1
77*9880d681SAndroid Build Coastguard Worker
78*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"="+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
79*9880d681SAndroid Build Coastguard Workerattributes #1 = { nounwind argmemonly }
80*9880d681SAndroid Build Coastguard Workerattributes #2 = { "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"="+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
81*9880d681SAndroid Build Coastguard Workerattributes #3 = { nounwind "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"="+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
82*9880d681SAndroid Build Coastguard Workerattributes #4 = { nounwind }
83