summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ProfileData/InstrProf.cpp
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2015-12-15 19:44:45 +0000
committerXinliang David Li <davidxl@google.com>2015-12-15 19:44:45 +0000
commit4ec401406e3d71aae58fa210b727175022937cf2 (patch)
tree9ea74205732b8b00206be578616d4c801e26c4b0 /llvm/lib/ProfileData/InstrProf.cpp
parent843fb204b7102bc1abd7fdadf39f3ac2e0acb479 (diff)
downloadbcm5719-llvm-4ec401406e3d71aae58fa210b727175022937cf2.tar.gz
bcm5719-llvm-4ec401406e3d71aae58fa210b727175022937cf2.zip
Coverage code refactoring /NFC
llvm-svn: 255670
Diffstat (limited to 'llvm/lib/ProfileData/InstrProf.cpp')
-rw-r--r--llvm/lib/ProfileData/InstrProf.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/ProfileData/InstrProf.cpp b/llvm/lib/ProfileData/InstrProf.cpp
index 40617171f09..723408b1c2a 100644
--- a/llvm/lib/ProfileData/InstrProf.cpp
+++ b/llvm/lib/ProfileData/InstrProf.cpp
@@ -102,6 +102,15 @@ std::string getPGOFuncName(const Function &F, uint64_t Version) {
Version);
}
+StringRef getFuncNameWithoutPrefix(StringRef PGOFuncName, StringRef FileName) {
+ if (FileName.empty())
+ return PGOFuncName;
+ // Drop the file name including ':'. See also getPGOFuncName.
+ if (PGOFuncName.startswith(FileName))
+ PGOFuncName = PGOFuncName.drop_front(FileName.size() + 1);
+ return PGOFuncName;
+}
+
// \p FuncName is the string used as profile lookup key for the function. A
// symbol is created to hold the name. Return the legalized symbol name.
static std::string getPGOFuncNameVarName(StringRef FuncName,
OpenPOWER on IntegriCloud