summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorWei Mi <wmi@google.com>2018-12-12 17:09:27 +0000
committerWei Mi <wmi@google.com>2018-12-12 17:09:27 +0000
commit7da5a08e1a50ca5da1a35a4fa83673bf96f37d3c (patch)
treef00c62ddb71f39d23e82c2a3d5515989d20455f6 /llvm/lib
parentd4f7d6a7a1ba16287a6a18422b8921534d846d18 (diff)
downloadbcm5719-llvm-7da5a08e1a50ca5da1a35a4fa83673bf96f37d3c.tar.gz
bcm5719-llvm-7da5a08e1a50ca5da1a35a4fa83673bf96f37d3c.zip
[SampleFDO] Extend profile-sample-accurate option to cover isFunctionColdInCallGraph
For SampleFDO, when a callsite doesn't appear in the profile, it will not be marked as cold callsite unless the option -profile-sample-accurate is specified. But profile-sample-accurate doesn't cover function isFunctionColdInCallGraph which is used to decide whether a function should be put into text.unlikely section, so even if the user knows the profile is accurate and specifies profile-sample-accurate, those functions not appearing in the sample profile are still not be put into text.unlikely section right now. The patch fixes that. Differential Revision: https://reviews.llvm.org/D55567 llvm-svn: 348940
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/ProfileSummaryInfo.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ProfileSummaryInfo.cpp b/llvm/lib/Analysis/ProfileSummaryInfo.cpp
index bd8459ddb82..4326e53b43b 100644
--- a/llvm/lib/Analysis/ProfileSummaryInfo.cpp
+++ b/llvm/lib/Analysis/ProfileSummaryInfo.cpp
@@ -261,7 +261,14 @@ bool ProfileSummaryInfo::isHotBlock(const BasicBlock *BB, BlockFrequencyInfo *BF
bool ProfileSummaryInfo::isColdBlock(const BasicBlock *BB,
BlockFrequencyInfo *BFI) {
auto Count = BFI->getBlockProfileCount(BB);
- return Count && isColdCount(*Count);
+ if (Count)
+ return isColdCount(*Count);
+ if (!hasSampleProfile())
+ return false;
+
+ const Function *F = BB->getParent();
+ return ProfileSampleAccurate ||
+ (F && F->hasFnAttribute("profile-sample-accurate"));
}
bool ProfileSummaryInfo::isHotCallSite(const CallSite &CS,
OpenPOWER on IntegriCloud