From 4e25daf5775cb489a53cdfbf02922e1b24717795 Mon Sep 17 00:00:00 2001 From: Vedant Kumar Date: Wed, 16 Mar 2016 20:49:26 +0000 Subject: [PATCH] [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@263662 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ProfileData/InstrProf.h | 6 ++++++ lib/ProfileData/InstrProf.cpp | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/llvm/ProfileData/InstrProf.h b/include/llvm/ProfileData/InstrProf.h index 3f3a7e472f6..2c11cb8975d 100644 --- a/include/llvm/ProfileData/InstrProf.h +++ b/include/llvm/ProfileData/InstrProf.h @@ -165,6 +165,12 @@ std::string getPGOFuncName(StringRef RawFuncName, StringRef FileName, uint64_t Version = INSTR_PROF_INDEX_VERSION); +/// Return the name of the global variable used to store a function +/// name in PGO instrumentation. \c FuncName is the name of the function +/// returned by the \c getPGOFuncName call. +std::string getPGOFuncNameVarName(StringRef FuncName, + GlobalValue::LinkageTypes Linkage); + /// Create and return the global variable for function name used in PGO /// instrumentation. \c FuncName is the name of the function returned /// by \c getPGOFuncName call. diff --git a/lib/ProfileData/InstrProf.cpp b/lib/ProfileData/InstrProf.cpp index 66ac03770e7..cec63005ed3 100644 --- a/lib/ProfileData/InstrProf.cpp +++ b/lib/ProfileData/InstrProf.cpp @@ -99,8 +99,8 @@ StringRef getFuncNameWithoutPrefix(StringRef PGOFuncName, StringRef FileName) { // \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, - GlobalValue::LinkageTypes Linkage) { +std::string getPGOFuncNameVarName(StringRef FuncName, + GlobalValue::LinkageTypes Linkage) { std::string VarName = getInstrProfNameVarPrefix(); VarName += FuncName;