[llvm] r283805 - Rename isHotFunction/isColdFunction to isFunctionEntryHot/isFunctionEntryCold. (NFC)
Dehao Chen via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 10 14:47:28 PDT 2016
Author: dehao
Date: Mon Oct 10 16:47:28 2016
New Revision: 283805
URL: http://llvm.org/viewvc/llvm-project?rev=283805&view=rev
Log:
Rename isHotFunction/isColdFunction to isFunctionEntryHot/isFunctionEntryCold. (NFC)
This is in preparation for https://reviews.llvm.org/D25048
Modified:
llvm/trunk/include/llvm/Analysis/ProfileSummaryInfo.h
llvm/trunk/lib/Analysis/InlineCost.cpp
llvm/trunk/lib/Analysis/ProfileSummaryInfo.cpp
Modified: llvm/trunk/include/llvm/Analysis/ProfileSummaryInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ProfileSummaryInfo.h?rev=283805&r1=283804&r2=283805&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/ProfileSummaryInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/ProfileSummaryInfo.h Mon Oct 10 16:47:28 2016
@@ -51,11 +51,11 @@ public:
ProfileSummaryInfo(Module &M) : M(M) {}
ProfileSummaryInfo(ProfileSummaryInfo &&Arg)
: M(Arg.M), Summary(std::move(Arg.Summary)) {}
+ /// \brief Returns true if \p F has hot function entry.
+ bool isFunctionEntryHot(const Function *F);
+ /// \brief Returns true if \p F has cold function entry.
+ bool isFunctionEntryCold(const Function *F);
/// \brief Returns true if \p F is a hot function.
- bool isHotFunction(const Function *F);
- /// \brief Returns true if \p F is a cold function.
- bool isColdFunction(const Function *F);
- /// \brief Returns true if count \p C is considered hot.
bool isHotCount(uint64_t C);
/// \brief Returns true if count \p C is considered cold.
bool isColdCount(uint64_t C);
Modified: llvm/trunk/lib/Analysis/InlineCost.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InlineCost.cpp?rev=283805&r1=283804&r2=283805&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/InlineCost.cpp (original)
+++ llvm/trunk/lib/Analysis/InlineCost.cpp Mon Oct 10 16:47:28 2016
@@ -647,14 +647,14 @@ void CallAnalyzer::updateThreshold(CallS
// when it would increase the threshold and the caller does not need to
// minimize its size.
bool InlineHint = Callee.hasFnAttribute(Attribute::InlineHint) ||
- PSI->isHotFunction(&Callee);
+ PSI->isFunctionEntryHot(&Callee);
if (InlineHint && !Caller->optForMinSize())
Threshold = MaxIfValid(Threshold, Params.HintThreshold);
if (HotCallsite && !Caller->optForMinSize())
Threshold = MaxIfValid(Threshold, Params.HotCallSiteThreshold);
- bool ColdCallee = PSI->isColdFunction(&Callee);
+ bool ColdCallee = PSI->isFunctionEntryCold(&Callee);
// For cold callees, use the ColdThreshold knob if it is available and reduces
// the threshold.
if (ColdCallee)
Modified: llvm/trunk/lib/Analysis/ProfileSummaryInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ProfileSummaryInfo.cpp?rev=283805&r1=283804&r2=283805&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ProfileSummaryInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/ProfileSummaryInfo.cpp Mon Oct 10 16:47:28 2016
@@ -63,10 +63,10 @@ void ProfileSummaryInfo::computeSummary(
Summary.reset(ProfileSummary::getFromMD(SummaryMD));
}
-/// Returns true if the function is a hot function. If it returns false, it
-/// either means it is not hot or it is unknown whether F is hot or not (for
+/// Returns true if the function's entry is hot. If it returns false, it
+/// either means it is not hot or it is unknown whether it is hot or not (for
/// example, no profile data is available).
-bool ProfileSummaryInfo::isHotFunction(const Function *F) {
+bool ProfileSummaryInfo::isFunctionEntryHot(const Function *F) {
computeSummary();
if (!F || !Summary)
return false;
@@ -79,10 +79,10 @@ bool ProfileSummaryInfo::isHotFunction(c
(uint64_t)(0.3 * (double)Summary->getMaxFunctionCount()));
}
-/// Returns true if the function is a cold function. If it returns false, it
-/// either means it is not cold or it is unknown whether F is cold or not (for
+/// Returns true if the function's entry is a cold. If it returns false, it
+/// either means it is not cold or it is unknown whether it is cold or not (for
/// example, no profile data is available).
-bool ProfileSummaryInfo::isColdFunction(const Function *F) {
+bool ProfileSummaryInfo::isFunctionEntryCold(const Function *F) {
computeSummary();
if (!F)
return false;
@@ -149,8 +149,6 @@ ProfileSummaryInfo ProfileSummaryAnalysi
return ProfileSummaryInfo(M);
}
-// FIXME: This only tests isHotFunction and isColdFunction and not the
-// isHotCount and isColdCount calls.
PreservedAnalyses ProfileSummaryPrinterPass::run(Module &M,
ModuleAnalysisManager &AM) {
ProfileSummaryInfo &PSI = AM.getResult<ProfileSummaryAnalysis>(M);
@@ -158,10 +156,10 @@ PreservedAnalyses ProfileSummaryPrinterP
OS << "Functions in " << M.getName() << " with hot/cold annotations: \n";
for (auto &F : M) {
OS << F.getName();
- if (PSI.isHotFunction(&F))
- OS << " :hot ";
- else if (PSI.isColdFunction(&F))
- OS << " :cold ";
+ if (PSI.isFunctionEntryHot(&F))
+ OS << " :hot entry ";
+ else if (PSI.isFunctionEntryCold(&F))
+ OS << " :cold entry ";
OS << "\n";
}
return PreservedAnalyses::all();
More information about the llvm-commits
mailing list