summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp')
-rw-r--r--llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
index 23947137c67..c8f6bb2b709 100644
--- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
+++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
@@ -750,6 +750,15 @@ void PGOUseFunc::annotateIndirectCallSites() {
if (DisableValueProfiling)
return;
+ // Write out the PGOFuncName if this is different from it's raw name.
+ // This should only apply to internal linkage functions only.
+ const std::string &FuncName = getPGOFuncName(F);
+ if (FuncName != F.getName()) {
+ LLVMContext &C = F.getContext();
+ MDNode *N = MDNode::get(C, MDString::get(C, FuncName.c_str()));
+ F.setMetadata("PGOFuncName", N);
+ }
+
unsigned IndirectCallSiteIndex = 0;
PGOIndirectCallSiteVisitor ICV;
ICV.visit(F);
OpenPOWER on IntegriCloud