blob: cf2e75757e7eaa0fc6e6e777dfedc0e705c2981f [file] [log] [blame]
Dehao Chenf0e27e62017-08-24 21:37:04 +00001; For SamplePGO, if -profile-sample-accurate is specified, cold callsite
Dehao Chenb2d1de52017-08-23 23:19:11 +00002; heuristics should be honored if the caller has no profile.
3
4; RUN: opt < %s -inline -S -inline-cold-callsite-threshold=0 | FileCheck %s
Dehao Chenb2d1de52017-08-23 23:19:11 +00005
6define i32 @callee(i32 %x) {
7 %x1 = add i32 %x, 1
8 %x2 = add i32 %x1, 1
9 %x3 = add i32 %x2, 1
10 call void @extern()
11 call void @extern()
12 ret i32 %x3
13}
14
15define i32 @caller(i32 %y1) {
Dehao Chenf0e27e62017-08-24 21:37:04 +000016; CHECK-LABEL: @caller
Dehao Chenb2d1de52017-08-23 23:19:11 +000017; CHECK-NOT: call i32 @callee
Dehao Chenf0e27e62017-08-24 21:37:04 +000018 %y2 = call i32 @callee(i32 %y1)
19 ret i32 %y2
20}
21
22define i32 @caller_accurate(i32 %y1) #0 {
23; CHECK-LABEL: @caller_accurate
24; CHECK: call i32 @callee
Dehao Chenb2d1de52017-08-23 23:19:11 +000025 %y2 = call i32 @callee(i32 %y1)
26 ret i32 %y2
27}
28
29declare void @extern()
30
Dehao Chenf0e27e62017-08-24 21:37:04 +000031attributes #0 = { "profile-sample-accurate" }
32
Dehao Chenb2d1de52017-08-23 23:19:11 +000033!llvm.module.flags = !{!1}
34!1 = !{i32 1, !"ProfileSummary", !2}
35!2 = !{!3, !4, !5, !6, !7, !8, !9, !10}
36!3 = !{!"ProfileFormat", !"SampleProfile"}
37!4 = !{!"TotalCount", i64 10000}
38!5 = !{!"MaxCount", i64 1000}
39!6 = !{!"MaxInternalCount", i64 1}
40!7 = !{!"MaxFunctionCount", i64 1000}
41!8 = !{!"NumCounts", i64 3}
42!9 = !{!"NumFunctions", i64 3}
43!10 = !{!"DetailedSummary", !11}
44!11 = !{!12, !13, !14}
45!12 = !{i32 10000, i64 100, i32 1}
46!13 = !{i32 999000, i64 100, i32 1}
47!14 = !{i32 999999, i64 1, i32 2}