Move accurate-sample-profile into the function attribute.

Summary: We need to have accurate-sample-profile in function attribute so that it works with LTO.

Reviewers: davidxl, rsmith

Reviewed By: davidxl

Subscribers: sanjoy, mehdi_amini, javed.absar, llvm-commits, eraman

Differential Revision: https://reviews.llvm.org/D37113

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311706 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dehao Chen
2017-08-24 21:37:04 +00:00
parent 2de563a9ab
commit d38687abb5
3 changed files with 17 additions and 6 deletions
+4 -3
View File
@@ -39,8 +39,8 @@ 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> AccurateSampleProfile(
"accurate-sample-profile", cl::Hidden, cl::init(false),
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."));
@@ -231,7 +231,8 @@ bool ProfileSummaryInfo::isColdCallSite(const CallSite &CS,
// 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()->getEntryCount() || AccurateSampleProfile));
(CS.getCaller()->getEntryCount() || ProfileSampleAccurate ||
CS.getCaller()->hasFnAttribute("profile-sample-accurate")));
}
INITIALIZE_PASS(ProfileSummaryInfoWrapperPass, "profile-summary-info",