[llvm] 44e5aaf - Remove an unused Module param
Wenlei He via llvm-commits
llvm-commits at lists.llvm.org
Sun May 10 22:10:16 PDT 2020
Author: Xun Li
Date: 2020-05-10T22:09:55-07:00
New Revision: 44e5aaf911751909d3e529c8bee4c380e4fa55a9
URL: https://github.com/llvm/llvm-project/commit/44e5aaf911751909d3e529c8bee4c380e4fa55a9
DIFF: https://github.com/llvm/llvm-project/commit/44e5aaf911751909d3e529c8bee4c380e4fa55a9.diff
LOG: Remove an unused Module param
Summary:
In D65848 the function getFuncNameInModule was refactored to no longer use module.
This diff removes the parameter and rename the function name to avoid confusion.
Reviewers: wenlei, wmi, davidxl
Reviewed By: wenlei
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79310
Added:
Modified:
llvm/include/llvm/ProfileData/SampleProf.h
llvm/lib/Transforms/IPO/SampleProfile.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/ProfileData/SampleProf.h b/llvm/include/llvm/ProfileData/SampleProf.h
index f1ddbe3ba579..b2975bf6a73f 100644
--- a/llvm/include/llvm/ProfileData/SampleProf.h
+++ b/llvm/include/llvm/ProfileData/SampleProf.h
@@ -444,9 +444,9 @@ class FunctionSamples {
if (FS != iter->second.end())
return &FS->second;
// If we cannot find exact match of the callee name, return the FS with
- // the max total count. Only do this when CalleeName is not provided,
+ // the max total count. Only do this when CalleeName is not provided,
// i.e., only for indirect calls.
- if (!CalleeName.empty())
+ if (!CalleeName.empty())
return nullptr;
uint64_t MaxTotalSamples = 0;
const FunctionSamples *R = nullptr;
@@ -533,8 +533,7 @@ class FunctionSamples {
for (const auto &BS : BodySamples)
for (const auto &TS : BS.second.getCallTargets())
if (TS.getValue() > Threshold) {
- const Function *Callee =
- M->getFunction(getNameInModule(TS.getKey(), M));
+ const Function *Callee = M->getFunction(getFuncName(TS.getKey()));
if (!Callee || !Callee->getSubprogram())
S.insert(getGUID(TS.getKey()));
}
@@ -549,10 +548,8 @@ class FunctionSamples {
/// Return the function name.
StringRef getName() const { return Name; }
- /// Return the original function name if it exists in Module \p M.
- StringRef getFuncNameInModule(const Module *M) const {
- return getNameInModule(Name, M);
- }
+ /// Return the original function name.
+ StringRef getFuncName() const { return getFuncName(Name); }
/// Return the canonical name for a function, taking into account
/// suffix elision policy attributes.
@@ -582,13 +579,14 @@ class FunctionSamples {
return F.getName();
}
- /// Translate \p Name into its original name in Module.
+ /// Translate \p Name into its original name.
/// When profile doesn't use MD5, \p Name needs no translation.
/// When profile uses MD5, \p Name in current FunctionSamples
- /// is actually GUID of the original function name. getNameInModule will
- /// translate \p Name in current FunctionSamples into its original name.
- /// If the original name doesn't exist in \p M, return empty StringRef.
- StringRef getNameInModule(StringRef Name, const Module *M) const {
+ /// is actually GUID of the original function name. getFuncName will
+ /// translate \p Name in current FunctionSamples into its original name
+ /// by looking up in the function map GUIDToFuncNameMap.
+ /// If the original name doesn't exist in the map, return empty StringRef.
+ StringRef getFuncName(StringRef Name) const {
if (!UseMD5)
return Name;
diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp
index 230982d321f8..85c81f3e6b41 100644
--- a/llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -944,7 +944,7 @@ void SampleProfileLoader::emitOptimizationRemarksForInlineCandidates(
for (auto I : Candidates) {
Function *CalledFunction = I->getCalledFunction();
if (CalledFunction) {
- ORE->emit(OptimizationRemarkAnalysis(CSINLINE_DEBUG, "InlineAttempt",
+ ORE->emit(OptimizationRemarkAnalysis(CSINLINE_DEBUG, "InlineAttempt",
I->getDebugLoc(), I->getParent())
<< "previous inlining reattempted for "
<< (Hot ? "hotness: '" : "size: '")
@@ -1025,7 +1025,7 @@ bool SampleProfileLoader::inlineHotFunctions(
PSI->getOrCompHotCountThreshold());
continue;
}
- auto CalleeFunctionName = FS->getFuncNameInModule(F.getParent());
+ auto CalleeFunctionName = FS->getFuncName();
// If it is a recursive call, we do not inline it as it could bloat
// the code exponentially. There is way to better handle this, e.g.
// clone the caller first, and inline the cloned caller if it is
More information about the llvm-commits
mailing list