[PATCH] D17084: [PGO] make the number of records for each value site metada adjustable
Rong Xu via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 10 11:11:17 PST 2016
xur created this revision.
xur added reviewers: davidxl, betulb.
xur added a subscriber: llvm-commits.
Add a parameter in annotateValueSite() to control the max number of records written
to the value profile meta data for each value site. The default is kept as the
current value of 3.
http://reviews.llvm.org/D17084
Files:
include/llvm/ProfileData/InstrProf.h
lib/ProfileData/InstrProf.cpp
Index: lib/ProfileData/InstrProf.cpp
===================================================================
--- lib/ProfileData/InstrProf.cpp
+++ lib/ProfileData/InstrProf.cpp
@@ -591,7 +591,8 @@
void annotateValueSite(Module &M, Instruction &Inst,
const InstrProfRecord &InstrProfR,
- InstrProfValueKind ValueKind, uint32_t SiteIdx) {
+ InstrProfValueKind ValueKind, uint32_t SiteIdx,
+ uint32_t MaxMDCount) {
uint32_t NV = InstrProfR.getNumValueDataForSite(ValueKind, SiteIdx);
uint64_t Sum = 0;
@@ -611,7 +612,7 @@
MDHelper.createConstant(ConstantInt::get(Type::getInt64Ty(Ctx), Sum)));
// Value Profile Data
- uint32_t MDCount = 3;
+ uint32_t MDCount = MaxMDCount;
for (uint32_t I = 0; I < NV; ++I) {
Vals.push_back(MDHelper.createConstant(
ConstantInt::get(Type::getInt64Ty(Ctx), VD[I].Value)));
Index: include/llvm/ProfileData/InstrProf.h
===================================================================
--- include/llvm/ProfileData/InstrProf.h
+++ include/llvm/ProfileData/InstrProf.h
@@ -214,9 +214,11 @@
/// Get the value profile data for value site \p SiteIdx from \p InstrProfR
/// and annotate the instruction \p Inst with the value profile meta data.
+/// Annotate up to \p MaxMDCount (default 3) number of records per value site.
void annotateValueSite(Module &M, Instruction &Inst,
const InstrProfRecord &InstrProfR,
- InstrProfValueKind ValueKind, uint32_t SiteIndx);
+ InstrProfValueKind ValueKind, uint32_t SiteIndx,
+ uint32_t MaxMDCount = 3);
/// Extract the value profile data from \p Inst which is annotated with
/// value profile meta data. Return false if there is no value data annotated,
/// otherwise return true.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17084.47489.patch
Type: text/x-patch
Size: 1872 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160210/3852a079/attachment.bin>
More information about the llvm-commits
mailing list