• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -inline -inline-threshold=0 -inlinehint-threshold=100 -S -enable-new-pm=0 | FileCheck %s
2
3; This tests that a hot callee gets the (higher) inlinehint-threshold even
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
6; because cost exceeds the inline-threshold. This test is relevant only when the
7; old pass manager is used.
8
9define i32 @callee1(i32 %x) !prof !21 {
10  %x1 = add i32 %x, 1
11  %x2 = add i32 %x1, 1
12  %x3 = add i32 %x2, 1
13  call void @extern()
14  ret i32 %x3
15}
16
17define i32 @callee2(i32 %x) !prof !22 {
18; CHECK-LABEL: @callee2(
19  %x1 = add i32 %x, 1
20  %x2 = add i32 %x1, 1
21  %x3 = add i32 %x2, 1
22  call void @extern()
23  ret i32 %x3
24}
25
26define i32 @caller2(i32 %y1) !prof !22 {
27; CHECK-LABEL: @caller2(
28; CHECK: call i32 @callee2
29; CHECK-NOT: call i32 @callee1
30; CHECK: ret i32 %x3.i
31  %y2 = call i32 @callee2(i32 %y1)
32  %y3 = call i32 @callee1(i32 %y2)
33  ret i32 %y3
34}
35
36declare void @extern()
37
38!llvm.module.flags = !{!1}
39!21 = !{!"function_entry_count", i64 300}
40!22 = !{!"function_entry_count", i64 1}
41
42!1 = !{i32 1, !"ProfileSummary", !2}
43!2 = !{!3, !4, !5, !6, !7, !8, !9, !10}
44!3 = !{!"ProfileFormat", !"InstrProf"}
45!4 = !{!"TotalCount", i64 10000}
46!5 = !{!"MaxCount", i64 1000}
47!6 = !{!"MaxInternalCount", i64 1}
48!7 = !{!"MaxFunctionCount", i64 1000}
49!8 = !{!"NumCounts", i64 3}
50!9 = !{!"NumFunctions", i64 3}
51!10 = !{!"DetailedSummary", !11}
52!11 = !{!12, !13, !14}
53!12 = !{i32 10000, i64 100, i32 1}
54!13 = !{i32 999000, i64 100, i32 1}
55!14 = !{i32 999999, i64 1, i32 2}
56