Skip to content

Commit 568ec13

Browse files
[memprof] Use structured binding (NFC) (#88096)
1 parent 93f0880 commit 568ec13

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

llvm/lib/ProfileData/InstrProfWriter.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -433,9 +433,9 @@ static uint64_t writeMemProfRecords(
433433
RecordWriter->Schema = Schema;
434434
OnDiskChainedHashTableGenerator<memprof::RecordWriterTrait>
435435
RecordTableGenerator;
436-
for (auto &I : MemProfRecordData) {
436+
for (auto &[GUID, Record] : MemProfRecordData) {
437437
// Insert the key (func hash) and value (memprof record).
438-
RecordTableGenerator.insert(I.first, I.second, *RecordWriter.get());
438+
RecordTableGenerator.insert(GUID, Record, *RecordWriter.get());
439439
}
440440
// Release the memory of this MapVector as it is no longer needed.
441441
MemProfRecordData.clear();
@@ -453,9 +453,9 @@ static uint64_t writeMemProfFrames(
453453
auto FrameWriter = std::make_unique<memprof::FrameWriterTrait>();
454454
OnDiskChainedHashTableGenerator<memprof::FrameWriterTrait>
455455
FrameTableGenerator;
456-
for (auto &I : MemProfFrameData) {
456+
for (auto &[FrameId, Frame] : MemProfFrameData) {
457457
// Insert the key (frame id) and value (frame contents).
458-
FrameTableGenerator.insert(I.first, I.second);
458+
FrameTableGenerator.insert(FrameId, Frame);
459459
}
460460
// Release the memory of this MapVector as it is no longer needed.
461461
MemProfFrameData.clear();

llvm/lib/ProfileData/RawMemProfReader.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -614,11 +614,11 @@ Error RawMemProfReader::readRawProfile(
614614
// Read in the MemInfoBlocks. Merge them based on stack id - we assume that
615615
// raw profiles in the same binary file are from the same process so the
616616
// stackdepot ids are the same.
617-
for (const auto &Value : readMemInfoBlocks(Next + Header->MIBOffset)) {
618-
if (CallstackProfileData.count(Value.first)) {
619-
CallstackProfileData[Value.first].Merge(Value.second);
617+
for (const auto &[Id, MIB] : readMemInfoBlocks(Next + Header->MIBOffset)) {
618+
if (CallstackProfileData.count(Id)) {
619+
CallstackProfileData[Id].Merge(MIB);
620620
} else {
621-
CallstackProfileData[Value.first] = Value.second;
621+
CallstackProfileData[Id] = MIB;
622622
}
623623
}
624624

0 commit comments

Comments
 (0)