Skip to content

[memprof] Use structured binding (NFC) #88096

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions llvm/lib/ProfileData/InstrProfWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,9 +433,9 @@ static uint64_t writeMemProfRecords(
RecordWriter->Schema = Schema;
OnDiskChainedHashTableGenerator<memprof::RecordWriterTrait>
RecordTableGenerator;
for (auto &I : MemProfRecordData) {
for (auto &[GUID, Record] : MemProfRecordData) {
// Insert the key (func hash) and value (memprof record).
RecordTableGenerator.insert(I.first, I.second, *RecordWriter.get());
RecordTableGenerator.insert(GUID, Record, *RecordWriter.get());
}
// Release the memory of this MapVector as it is no longer needed.
MemProfRecordData.clear();
Expand All @@ -453,9 +453,9 @@ static uint64_t writeMemProfFrames(
auto FrameWriter = std::make_unique<memprof::FrameWriterTrait>();
OnDiskChainedHashTableGenerator<memprof::FrameWriterTrait>
FrameTableGenerator;
for (auto &I : MemProfFrameData) {
for (auto &[FrameId, Frame] : MemProfFrameData) {
// Insert the key (frame id) and value (frame contents).
FrameTableGenerator.insert(I.first, I.second);
FrameTableGenerator.insert(FrameId, Frame);
}
// Release the memory of this MapVector as it is no longer needed.
MemProfFrameData.clear();
Expand Down
8 changes: 4 additions & 4 deletions llvm/lib/ProfileData/RawMemProfReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -614,11 +614,11 @@ Error RawMemProfReader::readRawProfile(
// Read in the MemInfoBlocks. Merge them based on stack id - we assume that
// raw profiles in the same binary file are from the same process so the
// stackdepot ids are the same.
for (const auto &Value : readMemInfoBlocks(Next + Header->MIBOffset)) {
if (CallstackProfileData.count(Value.first)) {
CallstackProfileData[Value.first].Merge(Value.second);
for (const auto &[Id, MIB] : readMemInfoBlocks(Next + Header->MIBOffset)) {
if (CallstackProfileData.count(Id)) {
CallstackProfileData[Id].Merge(MIB);
} else {
CallstackProfileData[Value.first] = Value.second;
CallstackProfileData[Id] = MIB;
}
}

Expand Down