[PATCH] D79310: Remove an unused Module param

Xun Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 3 19:41:55 PDT 2020


lxfind created this revision.
lxfind added a reviewer: wenlei.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

In D65848 <https://reviews.llvm.org/D65848> the function getFuncNameInModule was refactored to no longer use module.
This diff removes the parameter and rename the function name to avoid confusion.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79310

Files:
  llvm/include/llvm/ProfileData/SampleProf.h
  llvm/lib/Transforms/IPO/SampleProfile.cpp


Index: llvm/lib/Transforms/IPO/SampleProfile.cpp
===================================================================
--- llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -944,7 +944,7 @@
   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 @@
                                      PSI->getOrCompHotCountThreshold());
             continue;
           }
-          auto CalleeFunctionName = FS->getFuncNameInModule(F.getParent());
+          auto CalleeFunctionName = FS->getOriginalFuncName();
           // 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
Index: llvm/include/llvm/ProfileData/SampleProf.h
===================================================================
--- llvm/include/llvm/ProfileData/SampleProf.h
+++ llvm/include/llvm/ProfileData/SampleProf.h
@@ -444,9 +444,9 @@
     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;
@@ -534,7 +534,7 @@
       for (const auto &TS : BS.second.getCallTargets())
         if (TS.getValue() > Threshold) {
           const Function *Callee =
-              M->getFunction(getNameInModule(TS.getKey(), M));
+              M->getFunction(getOriginalFuncName(TS.getKey()));
           if (!Callee || !Callee->getSubprogram())
             S.insert(getGUID(TS.getKey()));
         }
@@ -549,10 +549,8 @@
   /// 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 getOriginalFuncName() const { return getOriginalFuncName(Name); }
 
   /// Return the canonical name for a function, taking into account
   /// suffix elision policy attributes.
@@ -582,13 +580,14 @@
     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. getOriginalFuncName 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 getOriginalFuncName(StringRef Name) const {
     if (!UseMD5)
       return Name;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79310.261732.patch
Type: text/x-patch
Size: 3793 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200504/98625c60/attachment.bin>


More information about the llvm-commits mailing list