[llvm] r263662 - [ProfileData] Make a utility method public, NFC

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 16 13:49:26 PDT 2016

Author: vedantk
Date: Wed Mar 16 15:49:26 2016
New Revision: 263662

URL: http://llvm.org/viewvc/llvm-project?rev=263662&view=rev
[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.


Modified: llvm/trunk/include/llvm/ProfileData/InstrProf.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/InstrProf.h?rev=263662&r1=263661&r2=263662&view=diff
--- llvm/trunk/include/llvm/ProfileData/InstrProf.h (original)
+++ llvm/trunk/include/llvm/ProfileData/InstrProf.h Wed Mar 16 15:49:26 2016
@@ -165,6 +165,12 @@ std::string getPGOFuncName(StringRef Raw
                            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.

Modified: llvm/trunk/lib/ProfileData/InstrProf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/InstrProf.cpp?rev=263662&r1=263661&r2=263662&view=diff
--- llvm/trunk/lib/ProfileData/InstrProf.cpp (original)
+++ llvm/trunk/lib/ProfileData/InstrProf.cpp Wed Mar 16 15:49:26 2016
@@ -99,8 +99,8 @@ StringRef getFuncNameWithoutPrefix(Strin
 // \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;

More information about the llvm-commits mailing list