Skip to content

Commit

Permalink
[ProfileData] Remove getValueForSite and getNumValueDataForSite (llvm…
Browse files Browse the repository at this point in the history
…#95989)

This patch removes getValueForSite and getNumValueDataForSite as I've
migrated all uses of them to getValueArrayForSite.
  • Loading branch information
kazutakahirata committed Jun 18, 2024
1 parent 300c41c commit 66df765
Showing 1 changed file with 0 additions and 41 deletions.
41 changes: 0 additions & 41 deletions llvm/include/llvm/ProfileData/InstrProf.h
Original file line number Diff line number Diff line change
Expand Up @@ -857,20 +857,6 @@ struct InstrProfRecord {
inline ArrayRef<InstrProfValueData> getValueArrayForSite(uint32_t ValueKind,
uint32_t Site) const;

/// Return the number of value data collected for ValueKind at profiling
/// 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;

/// Get the target value/counts of kind \p ValueKind collected at site
/// \p Site and store the result in array \p Dest.
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);

Expand Down Expand Up @@ -1048,38 +1034,11 @@ uint32_t InstrProfRecord::getNumValueSites(uint32_t ValueKind) const {
return getValueSitesForKind(ValueKind).size();
}

uint32_t InstrProfRecord::getNumValueDataForSite(uint32_t ValueKind,
uint32_t Site) const {
return getValueSitesForKind(ValueKind)[Site].ValueData.size();
}

ArrayRef<InstrProfValueData>
InstrProfRecord::getValueArrayForSite(uint32_t ValueKind, uint32_t Site) const {
return getValueSitesForKind(ValueKind)[Site].ValueData;
}

std::unique_ptr<InstrProfValueData[]>
InstrProfRecord::getValueForSite(uint32_t ValueKind, uint32_t Site) const {
uint32_t N = getNumValueDataForSite(ValueKind, Site);
if (N == 0)
return std::unique_ptr<InstrProfValueData[]>(nullptr);

auto VD = std::make_unique<InstrProfValueData[]>(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].Value = V.Value;
Dest[I].Count = V.Count;
I++;
}
}

void InstrProfRecord::reserveSites(uint32_t ValueKind, uint32_t NumValueSites) {
if (!NumValueSites)
return;
Expand Down

0 comments on commit 66df765

Please sign in to comment.