• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -inline -inline-threshold=0 -inlinehint-threshold=100 -S | FileCheck %s
2
3; This tests that a hot callsite gets the (higher) inlinehint-threshold even without
4; without inline hints and gets inlined because the cost is less than
5; inlinehint-threshold. A cold callee with identical body does not get inlined because
6; cost exceeds the inline-threshold
7
8define i32 @callee1(i32 %x) {
9  %x1 = add i32 %x, 1
10  %x2 = add i32 %x1, 1
11  %x3 = add i32 %x2, 1
12
13  ret i32 %x3
14}
15
16define i32 @callee2(i32 %x) {
17; CHECK-LABEL: @callee2(
18  %x1 = add i32 %x, 1
19  %x2 = add i32 %x1, 1
20  %x3 = add i32 %x2, 1
21
22  ret i32 %x3
23}
24
25define i32 @caller2(i32 %y1) {
26; CHECK-LABEL: @caller2(
27; CHECK: call i32 @callee2
28; CHECK-NOT: call i32 @callee1
29; CHECK: ret i32 %x3.i
30  %y2 = call i32 @callee2(i32 %y1), !prof !22
31  %y3 = call i32 @callee1(i32 %y2), !prof !21
32  ret i32 %y3
33}
34
35!llvm.module.flags = !{!1}
36!21 = !{!"branch_weights", i64 300}
37!22 = !{!"branch_weights", i64 1}
38
39!1 = !{i32 1, !"ProfileSummary", !2}
40!2 = !{!3, !4, !5, !6, !7, !8, !9, !10}
41!3 = !{!"ProfileFormat", !"InstrProf"}
42!4 = !{!"TotalCount", i64 10000}
43!5 = !{!"MaxCount", i64 1000}
44!6 = !{!"MaxInternalCount", i64 1}
45!7 = !{!"MaxFunctionCount", i64 1000}
46!8 = !{!"NumCounts", i64 3}
47!9 = !{!"NumFunctions", i64 3}
48!10 = !{!"DetailedSummary", !11}
49!11 = !{!12, !13, !14}
50!12 = !{i32 10000, i64 100, i32 1}
51!13 = !{i32 999000, i64 100, i32 1}
52!14 = !{i32 999999, i64 1, i32 2}
53