[llvm] [memprof] Use IndexedMemProfRecord in MemProfReader (NFC) (PR #117613)
Snehasish Kumar via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 26 12:19:09 PST 2024
================
@@ -42,43 +42,28 @@ class MemProfReader {
using Iterator = InstrProfIterator<GuidMemProfRecordPair, MemProfReader>;
Iterator end() { return Iterator(); }
Iterator begin() {
- Iter = FunctionProfileData.begin();
+ Iter = MemProfData.Records.begin();
return Iterator(this);
}
// Take the complete profile data.
- IndexedMemProfData takeMemProfData() {
- // TODO: Once we replace the three member variables, namely IdToFrame,
- // CSIdToCallStack, and FunctionProfileData, with MemProfData, replace the
- // following code with just "return std::move(MemProfData);".
- IndexedMemProfData MemProfData;
- // Copy key-value pairs because IdToFrame uses DenseMap, whereas
- // IndexedMemProfData::Frames uses MapVector.
- for (const auto &[FrameId, F] : IdToFrame)
- MemProfData.Frames.try_emplace(FrameId, F);
- // Copy key-value pairs because CSIdToCallStack uses DenseMap, whereas
- // IndexedMemProfData::CallStacks uses MapVector.
- for (const auto &[CSId, CS] : CSIdToCallStack)
- MemProfData.CallStacks.try_emplace(CSId, CS);
- MemProfData.Records = FunctionProfileData;
- return MemProfData;
- }
+ IndexedMemProfData takeMemProfData() { return std::move(MemProfData); }
----------------
snehasish wrote:
Add a comment to indicate the contents are no longer valid?
https://github.com/llvm/llvm-project/pull/117613
More information about the llvm-commits
mailing list