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

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 4 14:34:29 PST 2019


davidxl accepted this revision.
davidxl added a comment.
This revision is now accepted and ready to land.

lgtm



================
Comment at: lib/ProfileData/InstrProf.cpp:255
   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 : -1;
----------------
xur wrote:
> davidxl wrote:
> > xur wrote:
> > > davidxl wrote:
> > > > When StaticFullModulePrefix is false, should the base name be used ?
> > > Yes. when it's false, only use the basename. 
> > > In this patch, when it's false, StripLevel is -1, in which case, we strip all the paths and leave only the basename.
> > > 
> > > There is a test
> > > test/Transforms/PGOProfile/statics_counter_naming.ll
> > > that tests the stripping behavior.
> > but the stripLevel will be reset to StaticFuncStripDirNamePrefix which is 0 by default?
> It will not be reset as the cond in line 257 will be false if StripLevel is (unsigned) -1.
ok, please put an explicit type casting before '-1' to make it clearer.


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

https://reviews.llvm.org/D56327





More information about the llvm-commits mailing list