summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ProfileSummaryInfo.cpp
diff options
context:
space:
mode:
authorWei Mi <wmi@google.com>2018-05-10 23:02:27 +0000
committerWei Mi <wmi@google.com>2018-05-10 23:02:27 +0000
commit0c2f6be662d8b034b7f694df360a216463494fca (patch)
tree53a7688efab782f4ae9b77c81b6f55e44950eb7a /llvm/lib/Analysis/ProfileSummaryInfo.cpp
parente0b5f86b3083747beaf5d7639333af0109c9e6ef (diff)
downloadbcm5719-llvm-0c2f6be662d8b034b7f694df360a216463494fca.tar.gz
bcm5719-llvm-0c2f6be662d8b034b7f694df360a216463494fca.zip
[SampleFDO] Don't treat warm callsite with inline instance in the profile as cold
We found current sampleFDO had a performance issue when triaging a regression. For a callsite with inline instance in the profile, even if hot callsite inliner cannot inline it, it may still execute enough times and should not be treated as cold in regular inliner later. However, currently if such callsite is not inlined by hot callsite inliner, and the BB where the callsite locates doesn't get samples from other instructions inside of it, the callsite will have no profile metadata annotated. In regular inliner cost analysis, if the callsite has no profile annotated and its caller has profile information, it will be treated as cold. The fix changes the isCallsiteHot check and chooses to compare CallsiteTotalSamples with hot cutoff value computed by ProfileSummaryInfo. Differential Revision: https://reviews.llvm.org/D45377 llvm-svn: 332058
Diffstat (limited to 'llvm/lib/Analysis/ProfileSummaryInfo.cpp')
-rw-r--r--llvm/lib/Analysis/ProfileSummaryInfo.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ProfileSummaryInfo.cpp b/llvm/lib/Analysis/ProfileSummaryInfo.cpp
index 33b1ebdfcbf..fb591f5d6a6 100644
--- a/llvm/lib/Analysis/ProfileSummaryInfo.cpp
+++ b/llvm/lib/Analysis/ProfileSummaryInfo.cpp
@@ -223,6 +223,18 @@ bool ProfileSummaryInfo::isColdCount(uint64_t C) {
return ColdCountThreshold && C <= ColdCountThreshold.getValue();
}
+uint64_t ProfileSummaryInfo::getOrCompHotCountThreshold() {
+ if (!HotCountThreshold)
+ computeThresholds();
+ return HotCountThreshold && HotCountThreshold.getValue();
+}
+
+uint64_t ProfileSummaryInfo::getOrCompColdCountThreshold() {
+ if (!ColdCountThreshold)
+ computeThresholds();
+ return ColdCountThreshold && ColdCountThreshold.getValue();
+}
+
bool ProfileSummaryInfo::isHotBB(const BasicBlock *B, BlockFrequencyInfo *BFI) {
auto Count = BFI->getBlockProfileCount(B);
return Count && isHotCount(*Count);
OpenPOWER on IntegriCloud