xref: /llvm-project/llvm/test/CodeGen/X86/catchpad-weight.ll (revision 2f448bf509432c1a19ec46ab8cbc7353c03c6280)
1; RUN: llc -print-after=finalize-isel %s -o /dev/null 2>&1 | FileCheck %s
2
3; Check if the edge weight to the catchpad is calculated correctly.
4
5; CHECK: successors: %bb.2(0x7ffff100), %bb.1(0x00000800), %bb.3(0x00000400), %bb.4(0x00000200), %bb.5(0x00000100)
6
7target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
8target triple = "x86_64--windows-msvc18.0.0"
9
10%rtti.TypeDescriptor7 = type { ptr, ptr, [8 x i8] }
11%struct.HasDtor = type { i8 }
12
13$"\01??_R0?AUA@@@8" = comdat any
14
15$"\01??_R0?AUB@@@8" = comdat any
16
17$"\01??_R0?AUC@@@8" = comdat any
18
19@"\01??_7type_info@@6B@" = external constant ptr
20@"\01??_R0?AUA@@@8" = linkonce_odr global %rtti.TypeDescriptor7 { ptr @"\01??_7type_info@@6B@", ptr null, [8 x i8] c".?AUA@@\00" }, comdat
21@"\01??_R0?AUB@@@8" = linkonce_odr global %rtti.TypeDescriptor7 { ptr @"\01??_7type_info@@6B@", ptr null, [8 x i8] c".?AUB@@\00" }, comdat
22@"\01??_R0?AUC@@@8" = linkonce_odr global %rtti.TypeDescriptor7 { ptr @"\01??_7type_info@@6B@", ptr null, [8 x i8] c".?AUC@@\00" }, comdat
23
24; Function Attrs: uwtable
25define i32 @main() #0 personality ptr @__CxxFrameHandler3 {
26entry:
27  %o = alloca %struct.HasDtor, align 1
28  call void @llvm.lifetime.start.p0(i64 1, ptr %o) #4
29  invoke void @"\01?may_throw@@YAXXZ"()
30          to label %try.cont unwind label %catch.dispatch
31
32catch.dispatch:                                   ; preds = %entry
33  %cs1 = catchswitch within none [label %catch.5] unwind label %catch.dispatch.1
34
35catch.5:                                          ; preds = %catch.dispatch
36  %0 = catchpad within %cs1 [ptr @"\01??_R0?AUA@@@8", i32 0, ptr null]
37  catchret from %0 to label %try.cont
38
39try.cont:                                         ; preds = %entry, %catch, %catch.3, %catch.5
40  call void @"\01??1HasDtor@@QEAA@XZ"(ptr nonnull %o) #4
41  call void @llvm.lifetime.end.p0(i64 1, ptr %o) #4
42  ret i32 0
43
44catch.dispatch.1:                                 ; preds = %catch.dispatch
45  %cs2 = catchswitch within none [label %catch.3] unwind label %catch.dispatch.2
46
47catch.3:                                          ; preds = %catch.dispatch.1
48  %1 = catchpad within %cs2 [ptr @"\01??_R0?AUB@@@8", i32 0, ptr null]
49  catchret from %1 to label %try.cont
50
51catch.dispatch.2:                                 ; preds = %catch.dispatch.1
52  %cs3 = catchswitch within none [label %catch] unwind label %ehcleanup
53
54catch:                                            ; preds = %catch.dispatch.2
55  %2 = catchpad within %cs3 [ptr @"\01??_R0?AUC@@@8", i32 0, ptr null]
56  catchret from %2 to label %try.cont
57
58ehcleanup:                                        ; preds = %catchendblock
59  %3 = cleanuppad within none []
60  call void @"\01??1HasDtor@@QEAA@XZ"(ptr nonnull %o) #4 [ "funclet"(token %3) ]
61  cleanupret from %3 unwind to caller
62}
63
64; Function Attrs: nounwind argmemonly
65declare void @llvm.lifetime.start.p0(i64, ptr nocapture) #1
66
67declare void @"\01?may_throw@@YAXXZ"() #2
68
69declare i32 @__CxxFrameHandler3(...)
70
71; Function Attrs: nounwind
72declare void @"\01??1HasDtor@@QEAA@XZ"(ptr) #3
73
74; Function Attrs: nounwind argmemonly
75declare void @llvm.lifetime.end.p0(i64, ptr nocapture) #1
76
77attributes #0 = { uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "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" }
78attributes #1 = { nounwind argmemonly }
79attributes #2 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "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" }
80attributes #3 = { nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "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" }
81attributes #4 = { nounwind }
82