Replace all weight-based interfaces in MBB with probability-based interfaces, and...
[oota-llvm.git] / test / CodeGen / X86 / catchpad-weight.ll
1 ; RUN: llc -march=x86-64 -print-machineinstrs=expand-isel-pseudos %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 according to CFG: BB#3(0x7ffff100 / 0x80000000 = 100.00%) BB#1(0x00000800 / 0x80000000 = 0.00%) BB#4(0x00000400 / 0x80000000 = 0.00%) BB#6(0x00000200 / 0x80000000 = 0.00%) BB#8(0x00000100 / 0x80000000 = 0.00%)
6
7 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
8 target triple = "x86_64--windows-msvc18.0.0"
9
10 %rtti.TypeDescriptor7 = type { i8**, i8*, [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 i8*
20 @"\01??_R0?AUA@@@8" = linkonce_odr global %rtti.TypeDescriptor7 { i8** @"\01??_7type_info@@6B@", i8* null, [8 x i8] c".?AUA@@\00" }, comdat
21 @"\01??_R0?AUB@@@8" = linkonce_odr global %rtti.TypeDescriptor7 { i8** @"\01??_7type_info@@6B@", i8* null, [8 x i8] c".?AUB@@\00" }, comdat
22 @"\01??_R0?AUC@@@8" = linkonce_odr global %rtti.TypeDescriptor7 { i8** @"\01??_7type_info@@6B@", i8* null, [8 x i8] c".?AUC@@\00" }, comdat
23
24 ; Function Attrs: uwtable
25 define i32 @main() #0 personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
26 entry:
27   %o = alloca %struct.HasDtor, align 1
28   %0 = getelementptr inbounds %struct.HasDtor, %struct.HasDtor* %o, i64 0, i32 0
29   call void @llvm.lifetime.start(i64 1, i8* %0) #4
30   invoke void @"\01?may_throw@@YAXXZ"()
31           to label %try.cont unwind label %catch.dispatch
32
33 catch.dispatch:                                   ; preds = %entry
34   %1 = catchpad [%rtti.TypeDescriptor7* @"\01??_R0?AUA@@@8", i32 0, i8* null]
35           to label %catch.5 unwind label %catch.dispatch.1
36
37 catch.5:                                          ; preds = %catch.dispatch
38   catchret %1 to label %try.cont
39
40 try.cont:                                         ; preds = %entry, %catch, %catch.3, %catch.5
41   call void @"\01??1HasDtor@@QEAA@XZ"(%struct.HasDtor* nonnull %o) #4
42   call void @llvm.lifetime.end(i64 1, i8* %0) #4
43   ret i32 0
44
45 catch.dispatch.1:                                 ; preds = %catch.dispatch
46   %2 = catchpad [%rtti.TypeDescriptor7* @"\01??_R0?AUB@@@8", i32 0, i8* null]
47           to label %catch.3 unwind label %catch.dispatch.2
48
49 catch.3:                                          ; preds = %catch.dispatch.1
50   catchret %2 to label %try.cont
51
52 catch.dispatch.2:                                 ; preds = %catch.dispatch.1
53   %3 = catchpad [%rtti.TypeDescriptor7* @"\01??_R0?AUC@@@8", i32 0, i8* null]
54           to label %catch unwind label %catchendblock
55
56 catch:                                            ; preds = %catch.dispatch.2
57   catchret %3 to label %try.cont
58
59 catchendblock:                                    ; preds = %catch.dispatch.2
60   catchendpad unwind label %ehcleanup
61
62 ehcleanup:                                        ; preds = %catchendblock
63   %4 = cleanuppad []
64   call void @"\01??1HasDtor@@QEAA@XZ"(%struct.HasDtor* nonnull %o) #4
65   cleanupret %4 unwind to caller
66 }
67
68 ; Function Attrs: nounwind argmemonly
69 declare void @llvm.lifetime.start(i64, i8* nocapture) #1
70
71 declare void @"\01?may_throw@@YAXXZ"() #2
72
73 declare i32 @__CxxFrameHandler3(...)
74
75 ; Function Attrs: nounwind
76 declare void @"\01??1HasDtor@@QEAA@XZ"(%struct.HasDtor*) #3
77
78 ; Function Attrs: nounwind argmemonly
79 declare void @llvm.lifetime.end(i64, i8* nocapture) #1
80
81 attributes #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" }
82 attributes #1 = { nounwind argmemonly }
83 attributes #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" }
84 attributes #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" }
85 attributes #4 = { nounwind }