1 ; RUN: opt -globalopt -mtriple=powerpc64le-unknown-linux-gnu -ppc-enable-coldcc -S < %s | FileCheck %s -check-prefix=COLDCC
2 ; RUN: opt -globalopt -S < %s | FileCheck %s -check-prefix=CHECK
4 define signext i32 @caller(i32 signext %a, i32 signext %b, i32 signext %lim, i32 signext %i) local_unnamed_addr #0 !prof !30 {
6 ; COLDCC: call coldcc signext i32 @callee
7 ; CHECK: call fastcc signext i32 @callee
8 %add = add nsw i32 %b, %a
9 %sub = add nsw i32 %lim, -1
10 %cmp = icmp eq i32 %sub, %i
11 br i1 %cmp, label %if.then, label %if.end, !prof !31
13 if.then: ; preds = %entry
14 %call = tail call signext i32 @callee(i32 signext %a, i32 signext %b)
17 if.end: ; preds = %if.then, %entry
18 %f.0 = phi i32 [ %call, %if.then ], [ %add, %entry ]
22 define internal signext i32 @callee(i32 signext %a, i32 signext %b) unnamed_addr #0 {
24 %0 = tail call i32 asm "add $0, $1, $2", "=r,r,r,~{r6},~{r7},~{r8},~{r9}"(i32 %a, i32 %b) #1, !srcloc !32
25 %mul = mul nsw i32 %a, 3
27 %add = add nsw i32 %mul1, %mul
31 define signext i32 @main() local_unnamed_addr #0 !prof !33 {
35 for.cond.cleanup: ; preds = %for.body
36 %add.lcssa = phi i32 [ %add, %for.body ]
39 for.body: ; preds = %for.body, %entry
40 %i.011 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
41 %ret.010 = phi i32 [ 0, %entry ], [ %add, %for.body ]
42 %call = tail call signext i32 @caller(i32 signext 4, i32 signext 5, i32 signext 10000000, i32 signext %i.011)
43 %add = add nsw i32 %call, %ret.010
44 %inc = add nuw nsw i32 %i.011, 1
45 %exitcond = icmp eq i32 %inc, 10000000
46 br i1 %exitcond, label %for.cond.cleanup, label %for.body, !prof !34
48 attributes #0 = { noinline }
50 !0 = !{i32 1, !"ProfileSummary", !1}
51 !1 = !{!2, !3, !4, !5, !6, !7, !8, !9}
52 !2 = !{!"ProfileFormat", !"InstrProf"}
53 !3 = !{!"TotalCount", i64 20000003}
54 !4 = !{!"MaxCount", i64 10000000}
55 !5 = !{!"MaxInternalCount", i64 10000000}
56 !6 = !{!"MaxFunctionCount", i64 10000000}
57 !7 = !{!"NumCounts", i64 5}
58 !8 = !{!"NumFunctions", i64 3}
59 !9 = !{!"DetailedSummary", !10}
60 !10 = !{!11, !12, !13, !14, !15, !16, !16, !17, !17, !18, !19, !20, !21, !22, !23, !24, !25, !26}
61 !11 = !{i32 10000, i64 10000000, i32 2}
62 !12 = !{i32 100000, i64 10000000, i32 2}
63 !13 = !{i32 200000, i64 10000000, i32 2}
64 !14 = !{i32 300000, i64 10000000, i32 2}
65 !15 = !{i32 400000, i64 10000000, i32 2}
66 !16 = !{i32 500000, i64 10000000, i32 2}
67 !17 = !{i32 600000, i64 10000000, i32 2}
68 !18 = !{i32 700000, i64 10000000, i32 2}
69 !19 = !{i32 800000, i64 10000000, i32 2}
70 !20 = !{i32 900000, i64 10000000, i32 2}
71 !21 = !{i32 950000, i64 10000000, i32 2}
72 !22 = !{i32 990000, i64 10000000, i32 2}
73 !23 = !{i32 999000, i64 10000000, i32 2}
74 !24 = !{i32 999900, i64 10000000, i32 2}
75 !25 = !{i32 999990, i64 10000000, i32 2}
76 !26 = !{i32 999999, i64 10000000, i32 2}
77 !30 = !{!"function_entry_count", i64 10000000}
78 !31 = !{!"branch_weights", i32 2, i32 10000000}
80 !33 = !{!"function_entry_count", i64 1}
81 !34 = !{!"branch_weights", i32 2, i32 10000001}