| Dehao Chen | b2d1de5 | 2017-08-23 23:19:11 +0000 | [diff] [blame^] | 1 | ; 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 | |
| 7 | define 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 | |
| 16 | define 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 | |
| 23 | declare 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} |