[PATCH] D19433: [PGO] change the interface for createPGOFuncNameMetadata()
Rong Xu via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 22 14:06:10 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL267216: [PGO] change the interface for createPGOFuncNameMetadata() (authored by xur).
Changed prior to commit:
http://reviews.llvm.org/D19433?vs=54709&id=54721#toc
Repository:
rL LLVM
http://reviews.llvm.org/D19433
Files:
llvm/trunk/include/llvm/ProfileData/InstrProf.h
llvm/trunk/lib/ProfileData/InstrProf.cpp
llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
Index: llvm/trunk/include/llvm/ProfileData/InstrProf.h
===================================================================
--- llvm/trunk/include/llvm/ProfileData/InstrProf.h
+++ llvm/trunk/include/llvm/ProfileData/InstrProf.h
@@ -253,7 +253,7 @@
/// Create the PGOFuncName meta data if PGOFuncName is different from
/// function's raw name. This should only apply to internal linkage functions
/// declared by users only.
-void createPGOFuncNameMetadata(Function &F);
+void createPGOFuncNameMetadata(Function &F, const std::string &PGOFuncName);
const std::error_category &instrprof_category();
Index: llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
+++ llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
@@ -732,7 +732,7 @@
return;
// Create the PGOFuncName meta data.
- createPGOFuncNameMetadata(F);
+ createPGOFuncNameMetadata(F, FuncInfo.FuncName);
unsigned IndirectCallSiteIndex = 0;
auto IndirectCallSites = findIndirectCallSites(F);
Index: llvm/trunk/lib/ProfileData/InstrProf.cpp
===================================================================
--- llvm/trunk/lib/ProfileData/InstrProf.cpp
+++ llvm/trunk/lib/ProfileData/InstrProf.cpp
@@ -732,13 +732,15 @@
return F.getMetadata(getPGOFuncNameMetadataName());
}
-void createPGOFuncNameMetadata(Function &F) {
- const std::string &FuncName = getPGOFuncName(F);
- if (FuncName == F.getName())
+void createPGOFuncNameMetadata(Function &F, const std::string &PGOFuncName) {
+ // Only for internal linkage functions.
+ if (PGOFuncName == F.getName())
+ return;
+ // Don't create duplicated meta-data.
+ if (getPGOFuncNameMetadata(F))
return;
-
LLVMContext &C = F.getContext();
- MDNode *N = MDNode::get(C, MDString::get(C, FuncName.c_str()));
+ MDNode *N = MDNode::get(C, MDString::get(C, PGOFuncName.c_str()));
F.setMetadata(getPGOFuncNameMetadataName(), N);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19433.54721.patch
Type: text/x-patch
Size: 2047 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160422/525ea6f1/attachment.bin>
More information about the llvm-commits
mailing list