[PATCH] D56327: [PGO] Use SourceFileName rather module name in PGOFuncName

Rong Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 8 14:44:53 PST 2019


This revision was not accepted when it landed; it landed in state "Needs Revision".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL350671: [PGO] Use SourceFileName rather module name in PGOFuncName (authored by xur, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D56327?vs=180293&id=180746#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56327/new/

https://reviews.llvm.org/D56327

Files:
  llvm/trunk/lib/ProfileData/InstrProf.cpp


Index: llvm/trunk/lib/ProfileData/InstrProf.cpp
===================================================================
--- llvm/trunk/lib/ProfileData/InstrProf.cpp
+++ llvm/trunk/lib/ProfileData/InstrProf.cpp
@@ -252,11 +252,12 @@
 // data, its original linkage must be non-internal.
 std::string getPGOFuncName(const Function &F, bool InLTO, uint64_t Version) {
   if (!InLTO) {
-    StringRef FileName = (StaticFuncFullModulePrefix
-                              ? F.getParent()->getName()
-                              : sys::path::filename(F.getParent()->getName()));
-    if (StaticFuncFullModulePrefix && StaticFuncStripDirNamePrefix != 0)
-      FileName = stripDirPrefix(FileName, StaticFuncStripDirNamePrefix);
+    StringRef FileName(F.getParent()->getSourceFileName());
+    uint32_t StripLevel = StaticFuncFullModulePrefix ? 0 : (uint32_t)-1;
+    if (StripLevel < StaticFuncStripDirNamePrefix)
+      StripLevel = StaticFuncStripDirNamePrefix;
+    if (StripLevel)
+      FileName = stripDirPrefix(FileName, StripLevel);
     return getPGOFuncName(F.getName(), F.getLinkage(), FileName, Version);
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56327.180746.patch
Type: text/x-patch
Size: 1115 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190108/c688cfdd/attachment.bin>


More information about the llvm-commits mailing list