mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-11 13:37:07 +00:00
Minor refactor to make VP writing more efficient
llvm-svn: 253994
This commit is contained in:
parent
59fb3a9087
commit
57937fbcb6
@ -259,8 +259,11 @@ struct InstrProfRecord {
|
||||
/// site: Site.
|
||||
inline uint32_t getNumValueDataForSite(uint32_t ValueKind,
|
||||
uint32_t Site) const;
|
||||
/// Return the array of profiled values at \p Site.
|
||||
inline std::unique_ptr<InstrProfValueData[]>
|
||||
getValueForSite(uint32_t ValueKind, uint32_t Site) const;
|
||||
inline void getValueForSite(InstrProfValueData Dest[], uint32_t ValueKind,
|
||||
uint32_t Site) const;
|
||||
/// Reserve space for NumValueSites sites.
|
||||
inline void reserveSites(uint32_t ValueKind, uint32_t NumValueSites);
|
||||
/// Add ValueData for ValueKind at value Site.
|
||||
@ -369,15 +372,18 @@ InstrProfRecord::getValueForSite(uint32_t ValueKind, uint32_t Site) const {
|
||||
return std::unique_ptr<InstrProfValueData[]>(nullptr);
|
||||
|
||||
auto VD = llvm::make_unique<InstrProfValueData[]>(N);
|
||||
uint32_t I = 0;
|
||||
for (auto V : getValueSitesForKind(ValueKind)[Site].ValueData) {
|
||||
VD[I] = V;
|
||||
I++;
|
||||
}
|
||||
assert(I == N);
|
||||
getValueForSite(VD.get(), ValueKind, Site);
|
||||
|
||||
return VD;
|
||||
}
|
||||
void InstrProfRecord::getValueForSite(InstrProfValueData Dest[],
|
||||
uint32_t ValueKind, uint32_t Site) const {
|
||||
uint32_t I = 0;
|
||||
for (auto V : getValueSitesForKind(ValueKind)[Site].ValueData) {
|
||||
Dest[I] = V;
|
||||
I++;
|
||||
}
|
||||
}
|
||||
|
||||
void InstrProfRecord::addValueData(uint32_t ValueKind, uint32_t Site,
|
||||
InstrProfValueData *VData, uint32_t N,
|
||||
|
@ -166,10 +166,8 @@ void ValueProfRecord::serializeFrom(const InstrProfRecord &Record,
|
||||
for (uint32_t S = 0; S < NumValueSites; S++) {
|
||||
uint32_t ND = Record.getNumValueDataForSite(ValueKind, S);
|
||||
SiteCountArray[S] = ND;
|
||||
std::unique_ptr<InstrProfValueData[]> SrcVD =
|
||||
Record.getValueForSite(ValueKind, S);
|
||||
Record.getValueForSite(DstVD, ValueKind, S);
|
||||
for (uint32_t I = 0; I < ND; I++) {
|
||||
DstVD[I] = SrcVD[I];
|
||||
switch (ValueKind) {
|
||||
case IPVK_IndirectCallTarget:
|
||||
DstVD[I].Value = IndexedInstrProf::ComputeHash(
|
||||
|
Loading…
Reference in New Issue
Block a user