Skip to content

Commit aa0cae6

Browse files
committed
[ProfileData] Make a utility method public, NFC
The swift frontend needs to be able to look up PGO function name variables based on the original raw function name. That's because it's not possible to create PGO function name variables while emitting swift IR. Instead, we have to create the name variables while lowering swift IR to llvm IR, at which point we fix up all calls to the increment intrinsic to point to the right name variable. llvm-svn: 263662
1 parent b30ce58 commit aa0cae6

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

llvm/include/llvm/ProfileData/InstrProf.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@ std::string getPGOFuncName(StringRef RawFuncName,
165165
StringRef FileName,
166166
uint64_t Version = INSTR_PROF_INDEX_VERSION);
167167

168+
/// Return the name of the global variable used to store a function
169+
/// name in PGO instrumentation. \c FuncName is the name of the function
170+
/// returned by the \c getPGOFuncName call.
171+
std::string getPGOFuncNameVarName(StringRef FuncName,
172+
GlobalValue::LinkageTypes Linkage);
173+
168174
/// Create and return the global variable for function name used in PGO
169175
/// instrumentation. \c FuncName is the name of the function returned
170176
/// by \c getPGOFuncName call.

llvm/lib/ProfileData/InstrProf.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ StringRef getFuncNameWithoutPrefix(StringRef PGOFuncName, StringRef FileName) {
9999

100100
// \p FuncName is the string used as profile lookup key for the function. A
101101
// symbol is created to hold the name. Return the legalized symbol name.
102-
static std::string getPGOFuncNameVarName(StringRef FuncName,
103-
GlobalValue::LinkageTypes Linkage) {
102+
std::string getPGOFuncNameVarName(StringRef FuncName,
103+
GlobalValue::LinkageTypes Linkage) {
104104
std::string VarName = getInstrProfNameVarPrefix();
105105
VarName += FuncName;
106106

0 commit comments

Comments
 (0)