summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ProfileData/InstrProf.cpp
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2016-07-12 17:14:51 +0000
committerXinliang David Li <davidxl@google.com>2016-07-12 17:14:51 +0000
commit9eb472ba4bb3672c2808fe6118818bc983d7dd1d (patch)
treeeca68575f862e41717b693345cce14107d93a440 /llvm/lib/ProfileData/InstrProf.cpp
parent4a6a751dce9201f2a8434fcf1aad06b65535f464 (diff)
downloadbcm5719-llvm-9eb472ba4bb3672c2808fe6118818bc983d7dd1d.tar.gz
bcm5719-llvm-9eb472ba4bb3672c2808fe6118818bc983d7dd1d.zip
[PGO] Don't include full file path in static function profile counter names
Patch by Jake VanAdrighem Differential Revision: http://reviews.llvm.org/D22028 llvm-svn: 275193
Diffstat (limited to 'llvm/lib/ProfileData/InstrProf.cpp')
-rw-r--r--llvm/lib/ProfileData/InstrProf.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/llvm/lib/ProfileData/InstrProf.cpp b/llvm/lib/ProfileData/InstrProf.cpp
index aa84bd37577..6962f82a5ef 100644
--- a/llvm/lib/ProfileData/InstrProf.cpp
+++ b/llvm/lib/ProfileData/InstrProf.cpp
@@ -23,9 +23,15 @@
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/LEB128.h"
#include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/Path.h"
using namespace llvm;
+static cl::opt<bool> StaticFuncFullModulePrefix(
+ "static-func-full-module-prefix", cl::init(false),
+ cl::desc("Use full module build paths in the profile counter names for "
+ "static functions."));
+
namespace {
std::string getInstrProfErrString(instrprof_error Err) {
switch (Err) {
@@ -135,9 +141,12 @@ std::string getPGOFuncName(StringRef RawFuncName,
// (PGOUseFunc::annotateIndirectCallSites). If a symbol does not have the meta
// data, its original linkage must be non-internal.
std::string getPGOFuncName(const Function &F, bool InLTO, uint64_t Version) {
- if (!InLTO)
- return getPGOFuncName(F.getName(), F.getLinkage(), F.getParent()->getName(),
- Version);
+ if (!InLTO) {
+ StringRef FileName = (StaticFuncFullModulePrefix
+ ? F.getParent()->getName()
+ : sys::path::filename(F.getParent()->getName()));
+ return getPGOFuncName(F.getName(), F.getLinkage(), FileName, Version);
+ }
// In LTO mode (when InLTO is true), first check if there is a meta data.
if (MDNode *MD = getPGOFuncNameMetadata(F)) {
OpenPOWER on IntegriCloud