Skip to content

Commit 089c4bb

Browse files
[ProfileData] Use ArrayRef instead of const std::vector<T> & (NFC) (#94878)
1 parent e090bac commit 089c4bb

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

llvm/lib/ProfileData/InstrProfReader.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,8 @@ readBinaryIdsInternal(const MemoryBuffer &DataBuffer,
138138
return Error::success();
139139
}
140140

141-
static void
142-
printBinaryIdsInternal(raw_ostream &OS,
143-
const std::vector<llvm::object::BuildID> &BinaryIds) {
141+
static void printBinaryIdsInternal(raw_ostream &OS,
142+
ArrayRef<llvm::object::BuildID> BinaryIds) {
144143
OS << "Binary IDs: \n";
145144
for (const auto &BI : BinaryIds) {
146145
for (auto I : BI)
@@ -1502,7 +1501,7 @@ Expected<InstrProfRecord> IndexedInstrProfReader::getInstrProfRecord(
15021501
// A flag to indicate if the records are from the same type
15031502
// of profile (i.e cs vs nocs).
15041503
bool CSBitMatch = false;
1505-
auto getFuncSum = [](const std::vector<uint64_t> &Counts) {
1504+
auto getFuncSum = [](ArrayRef<uint64_t> Counts) {
15061505
uint64_t ValueSum = 0;
15071506
for (uint64_t CountValue : Counts) {
15081507
if (CountValue == (uint64_t)-1)

llvm/lib/ProfileData/SampleProfWriter.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -811,8 +811,7 @@ std::error_code SampleProfileWriterBinary::writeSummary() {
811811
encodeULEB128(Summary->getMaxFunctionCount(), OS);
812812
encodeULEB128(Summary->getNumCounts(), OS);
813813
encodeULEB128(Summary->getNumFunctions(), OS);
814-
const std::vector<ProfileSummaryEntry> &Entries =
815-
Summary->getDetailedSummary();
814+
ArrayRef<ProfileSummaryEntry> Entries = Summary->getDetailedSummary();
816815
encodeULEB128(Entries.size(), OS);
817816
for (auto Entry : Entries) {
818817
encodeULEB128(Entry.Cutoff, OS);

0 commit comments

Comments
 (0)