1 ; RUN: opt < %s -passes='require<profile-summary>,cgscc(inline)' -inline-threshold=0 -inlinehint-threshold=0 -hot-callsite-threshold=100 -S | FileCheck %s
3 ; This tests that a callsite which is determined to be hot based on the caller's
4 ; entry count and the callsite block frequency gets the hot-callsite-threshold.
5 ; Another callsite with the same callee that is not hot does not get inlined
6 ; because cost exceeds the inline-threshold. inlinthint-threshold is set to 0
7 ; to ensure callee's hotness is not used to boost the threshold.
9 define i32 @callee1(i32 %x) !prof !21 {
17 define i32 @caller(i32 %n) !prof !22 {
18 ; CHECK-LABEL: @caller(
19 %cond = icmp sle i32 %n, 100
20 br i1 %cond, label %cond_true, label %cond_false, !prof !0
23 ; CHECK-LABEL: cond_true:
24 ; CHECK-NOT: call i32 @callee1
25 ; CHECK: ret i32 %x3.i
26 %i = call i32 @callee1(i32 %n)
29 ; CHECK-LABEL: cond_false:
30 ; CHECK: call i32 @callee1
32 %j = call i32 @callee1(i32 %n)
35 declare void @extern()
37 !0 = !{!"branch_weights", i32 64, i32 4}
39 !llvm.module.flags = !{!1}
40 !21 = !{!"function_entry_count", i64 200}
41 !22 = !{!"function_entry_count", i64 200}
43 !1 = !{i32 1, !"ProfileSummary", !2}
44 !2 = !{!3, !4, !5, !6, !7, !8, !9, !10}
45 !3 = !{!"ProfileFormat", !"InstrProf"}
46 !4 = !{!"TotalCount", i64 10000}
47 !5 = !{!"MaxCount", i64 1000}
48 !6 = !{!"MaxInternalCount", i64 1}
49 !7 = !{!"MaxFunctionCount", i64 1000}
50 !8 = !{!"NumCounts", i64 3}
51 !9 = !{!"NumFunctions", i64 3}
52 !10 = !{!"DetailedSummary", !11}
53 !11 = !{!12, !13, !14}
54 !12 = !{i32 10000, i64 100, i32 1}
55 !13 = !{i32 999000, i64 100, i32 1}
56 !14 = !{i32 999999, i64 1, i32 2}