[llvm] [ProfileData] Take ArrayRef<InstrProfValueData> in addValueData (NFC) (PR #97363)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 10 20:05:12 PDT 2024
================
@@ -998,18 +998,18 @@ uint64_t InstrProfRecord::remapValue(uint64_t Value, uint32_t ValueKind,
}
void InstrProfRecord::addValueData(uint32_t ValueKind, uint32_t Site,
- InstrProfValueData *VData, uint32_t N,
+ ArrayRef<InstrProfValueData> VData,
InstrProfSymtab *ValueMap) {
- for (uint32_t I = 0; I < N; I++) {
- VData[I].Value = remapValue(VData[I].Value, ValueKind, ValueMap);
- }
std::vector<InstrProfValueSiteRecord> &ValueSites =
getOrCreateValueSitesForKind(ValueKind);
assert(ValueSites.size() == Site);
- if (N == 0)
+ if (VData.empty())
ValueSites.emplace_back();
- else
- ValueSites.emplace_back(VData, VData + N);
+ else {
+ ValueSites.emplace_back(VData.begin(), VData.end());
+ for (auto &V : ValueSites.back().ValueData)
----------------
kazutakahirata wrote:
I hope the latest iteration simplifies things a bit. We remap values first in a temporary vector. Then we add the vector to the value site with the move semantics.
https://github.com/llvm/llvm-project/pull/97363
More information about the llvm-commits
mailing list