• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -passes='require<profile-summary>,cgscc(inline)' -inline-threshold=100 -inline-cold-callsite-threshold=0 -S | FileCheck %s
2
3; This tests that a cold callsite gets the inline-cold-callsite-threshold
4; and does not get inlined. Another callsite to an identical callee that
5; is not cold gets inlined because cost is below the inline-threshold.
6
7define i32 @callee1(i32 %x) !prof !21 {
8  %x1 = add i32 %x, 1
9  %x2 = add i32 %x1, 1
10  %x3 = add i32 %x2, 1
11  call void @extern()
12  ret i32 %x3
13}
14
15define i32 @caller(i32 %n) !prof !22 {
16; CHECK-LABEL: @caller(
17  %cond = icmp sle i32 %n, 100
18  br i1 %cond, label %cond_true, label %cond_false, !prof !0
19
20cond_true:
21; CHECK-LABEL: cond_true:
22; CHECK-NOT: call i32 @callee1
23; CHECK: ret i32 %x3.i
24  %i = call i32 @callee1(i32 %n)
25  ret i32 %i
26cond_false:
27; CHECK-LABEL: cond_false:
28; CHECK: call i32 @callee1
29; CHECK: ret i32 %j
30  %j = call i32 @callee1(i32 %n)
31  ret i32 %j
32}
33declare void @extern()
34
35!0 = !{!"branch_weights", i32 200, i32 1}
36
37!llvm.module.flags = !{!1}
38!21 = !{!"function_entry_count", i64 200}
39!22 = !{!"function_entry_count", i64 200}
40
41!1 = !{i32 1, !"ProfileSummary", !2}
42!2 = !{!3, !4, !5, !6, !7, !8, !9, !10}
43!3 = !{!"ProfileFormat", !"InstrProf"}
44!4 = !{!"TotalCount", i64 10000}
45!5 = !{!"MaxCount", i64 1000}
46!6 = !{!"MaxInternalCount", i64 1}
47!7 = !{!"MaxFunctionCount", i64 1000}
48!8 = !{!"NumCounts", i64 3}
49!9 = !{!"NumFunctions", i64 3}
50!10 = !{!"DetailedSummary", !11}
51!11 = !{!12, !13, !14}
52!12 = !{i32 10000, i64 1000, i32 1}
53!13 = !{i32 999000, i64 1000, i32 1}
54!14 = !{i32 999999, i64 1, i32 2}
55