[llvm] a61048b - [MemProf][NFC] Hoist size computation out of the loop for v3 (#137479)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 28 11:16:32 PDT 2025
Author: Snehasish Kumar
Date: 2025-04-28T11:16:29-07:00
New Revision: a61048bbcd4708f6c89c16846d0bd89f997f4932
URL: https://github.com/llvm/llvm-project/commit/a61048bbcd4708f6c89c16846d0bd89f997f4932
DIFF: https://github.com/llvm/llvm-project/commit/a61048bbcd4708f6c89c16846d0bd89f997f4932.diff
LOG: [MemProf][NFC] Hoist size computation out of the loop for v3 (#137479)
Similar to the suggestion in #137394. In this case apply it to the current binary format (v3).
Added:
Modified:
llvm/lib/ProfileData/MemProf.cpp
Removed:
################################################################################
diff --git a/llvm/lib/ProfileData/MemProf.cpp b/llvm/lib/ProfileData/MemProf.cpp
index c3a2767fd8130..1e7d78005cd22 100644
--- a/llvm/lib/ProfileData/MemProf.cpp
+++ b/llvm/lib/ProfileData/MemProf.cpp
@@ -190,12 +190,13 @@ static IndexedMemProfRecord deserializeV3(const MemProfSchema &Schema,
const uint64_t NumNodes =
endian::readNext<uint64_t, llvm::endianness::little>(Ptr);
Record.AllocSites.reserve(NumNodes);
+ const size_t SerializedSize = PortableMemInfoBlock::serializedSize(Schema);
for (uint64_t I = 0; I < NumNodes; I++) {
IndexedAllocationInfo Node;
Node.CSId =
endian::readNext<LinearCallStackId, llvm::endianness::little>(Ptr);
Node.Info.deserialize(Schema, Ptr);
- Ptr += PortableMemInfoBlock::serializedSize(Schema);
+ Ptr += SerializedSize;
Record.AllocSites.push_back(Node);
}
More information about the llvm-commits
mailing list