summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ProfileData/InstrProf.cpp
diff options
context:
space:
mode:
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