diff options
author | Wei Mi <wmi@google.com> | 2018-12-13 21:51:42 +0000 |
---|---|---|
committer | Wei Mi <wmi@google.com> | 2018-12-13 21:51:42 +0000 |
commit | 66c6c5abea94e3fcaef169f54b0c91e087ec15dc (patch) | |
tree | c10fea0e5612aab1501b3ce07614621d82e0c01f /llvm/lib/Analysis | |
parent | 7b05666a19c1310d2d3b7e05d08313695b4eaa92 (diff) | |
download | bcm5719-llvm-66c6c5abea94e3fcaef169f54b0c91e087ec15dc.tar.gz bcm5719-llvm-66c6c5abea94e3fcaef169f54b0c91e087ec15dc.zip |
[SampleFDO] handle ProfileSampleAccurate when initializing function entry count
ProfileSampleAccurate is used to indicate the profile has exact match to the
code to be optimized.
Previously ProfileSampleAccurate is handled in ProfileSummaryInfo::isColdCallSite
and ProfileSummaryInfo::isColdBlock. A better solution is to initialize function
entry count to 0 when ProfileSampleAccurate is true, so we don't have to handle
ProfileSampleAccurate in multiple places.
Differential Revision: https://reviews.llvm.org/D55660
llvm-svn: 349088
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r-- | llvm/lib/Analysis/ProfileSummaryInfo.cpp | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/llvm/lib/Analysis/ProfileSummaryInfo.cpp b/llvm/lib/Analysis/ProfileSummaryInfo.cpp index 4326e53b43b..1d70c75f2e1 100644 --- a/llvm/lib/Analysis/ProfileSummaryInfo.cpp +++ b/llvm/lib/Analysis/ProfileSummaryInfo.cpp @@ -39,11 +39,6 @@ static cl::opt<int> ProfileSummaryCutoffCold( cl::desc("A count is cold if it is below the minimum count" " to reach this percentile of total counts.")); -static cl::opt<bool> ProfileSampleAccurate( - "profile-sample-accurate", cl::Hidden, cl::init(false), - cl::desc("If the sample profile is accurate, we will mark all un-sampled " - "callsite as cold. Otherwise, treat un-sampled callsites as if " - "we have no profile.")); static cl::opt<unsigned> ProfileSummaryHugeWorkingSetSizeThreshold( "profile-summary-huge-working-set-size-threshold", cl::Hidden, cl::init(15000), cl::ZeroOrMore, @@ -261,14 +256,7 @@ bool ProfileSummaryInfo::isHotBlock(const BasicBlock *BB, BlockFrequencyInfo *BF bool ProfileSummaryInfo::isColdBlock(const BasicBlock *BB, BlockFrequencyInfo *BFI) { auto Count = BFI->getBlockProfileCount(BB); - if (Count) - return isColdCount(*Count); - if (!hasSampleProfile()) - return false; - - const Function *F = BB->getParent(); - return ProfileSampleAccurate || - (F && F->hasFnAttribute("profile-sample-accurate")); + return Count && isColdCount(*Count); } bool ProfileSummaryInfo::isHotCallSite(const CallSite &CS, @@ -285,11 +273,7 @@ bool ProfileSummaryInfo::isColdCallSite(const CallSite &CS, // In SamplePGO, if the caller has been sampled, and there is no profile // annotated on the callsite, we consider the callsite as cold. - // If there is no profile for the caller, and we know the profile is - // accurate, we consider the callsite as cold. - return (hasSampleProfile() && - (CS.getCaller()->hasProfileData() || ProfileSampleAccurate || - CS.getCaller()->hasFnAttribute("profile-sample-accurate"))); + return hasSampleProfile() && CS.getCaller()->hasProfileData(); } INITIALIZE_PASS(ProfileSummaryInfoWrapperPass, "profile-summary-info", |