blob: 891781eb471d42399606c3de2831c8df9435de05 [file] [log] [blame]
Dehao Chenb2d1de52017-08-23 23:19:11 +00001; For SamplePGO, if -accurate-sample-profile is specified, cold callsite
2; heuristics should be honored if the caller has no profile.
3
4; RUN: opt < %s -inline -S -inline-cold-callsite-threshold=0 | FileCheck %s
5; RUN: opt < %s -inline -S -inline-cold-callsite-threshold=0 -accurate-sample-profile | FileCheck %s --check-prefix=ACCURATE
6
7define i32 @callee(i32 %x) {
8 %x1 = add i32 %x, 1
9 %x2 = add i32 %x1, 1
10 %x3 = add i32 %x2, 1
11 call void @extern()
12 call void @extern()
13 ret i32 %x3
14}
15
16define i32 @caller(i32 %y1) {
17; CHECK-NOT: call i32 @callee
18; ACCURATE: call i32 @callee
19 %y2 = call i32 @callee(i32 %y1)
20 ret i32 %y2
21}
22
23declare void @extern()
24
25!llvm.module.flags = !{!1}
26!1 = !{i32 1, !"ProfileSummary", !2}
27!2 = !{!3, !4, !5, !6, !7, !8, !9, !10}
28!3 = !{!"ProfileFormat", !"SampleProfile"}
29!4 = !{!"TotalCount", i64 10000}
30!5 = !{!"MaxCount", i64 1000}
31!6 = !{!"MaxInternalCount", i64 1}
32!7 = !{!"MaxFunctionCount", i64 1000}
33!8 = !{!"NumCounts", i64 3}
34!9 = !{!"NumFunctions", i64 3}
35!10 = !{!"DetailedSummary", !11}
36!11 = !{!12, !13, !14}
37!12 = !{i32 10000, i64 100, i32 1}
38!13 = !{i32 999000, i64 100, i32 1}
39!14 = !{i32 999999, i64 1, i32 2}