From f00d12e1c0b550c7e3df6363507c73f26e8a8f2b Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sat, 8 Jun 2024 18:20:28 -0700 Subject: [PATCH] [ProfileData] Use ArrayRef instead of const std::vector & (NFC) --- llvm/lib/ProfileData/InstrProfReader.cpp | 7 +++---- llvm/lib/ProfileData/SampleProfWriter.cpp | 3 +-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/llvm/lib/ProfileData/InstrProfReader.cpp b/llvm/lib/ProfileData/InstrProfReader.cpp index 54a2a61c31875..dad42007c1aec 100644 --- a/llvm/lib/ProfileData/InstrProfReader.cpp +++ b/llvm/lib/ProfileData/InstrProfReader.cpp @@ -138,9 +138,8 @@ readBinaryIdsInternal(const MemoryBuffer &DataBuffer, return Error::success(); } -static void -printBinaryIdsInternal(raw_ostream &OS, - const std::vector &BinaryIds) { +static void printBinaryIdsInternal(raw_ostream &OS, + ArrayRef BinaryIds) { OS << "Binary IDs: \n"; for (const auto &BI : BinaryIds) { for (auto I : BI) @@ -1502,7 +1501,7 @@ Expected IndexedInstrProfReader::getInstrProfRecord( // A flag to indicate if the records are from the same type // of profile (i.e cs vs nocs). bool CSBitMatch = false; - auto getFuncSum = [](const std::vector &Counts) { + auto getFuncSum = [](ArrayRef Counts) { uint64_t ValueSum = 0; for (uint64_t CountValue : Counts) { if (CountValue == (uint64_t)-1) diff --git a/llvm/lib/ProfileData/SampleProfWriter.cpp b/llvm/lib/ProfileData/SampleProfWriter.cpp index 625e523f13cec..1630fefb4fcfb 100644 --- a/llvm/lib/ProfileData/SampleProfWriter.cpp +++ b/llvm/lib/ProfileData/SampleProfWriter.cpp @@ -811,8 +811,7 @@ std::error_code SampleProfileWriterBinary::writeSummary() { encodeULEB128(Summary->getMaxFunctionCount(), OS); encodeULEB128(Summary->getNumCounts(), OS); encodeULEB128(Summary->getNumFunctions(), OS); - const std::vector &Entries = - Summary->getDetailedSummary(); + ArrayRef Entries = Summary->getDetailedSummary(); encodeULEB128(Entries.size(), OS); for (auto Entry : Entries) { encodeULEB128(Entry.Cutoff, OS);