[llvm] [memprof] Use uint32_t for linear call stack IDs (PR #93924)
Teresa Johnson via llvm-commits
llvm-commits at lists.llvm.org
Fri May 31 06:43:19 PDT 2024
================
@@ -259,6 +285,37 @@ static IndexedMemProfRecord deserializeV2(const MemProfSchema &Schema,
return Record;
}
+static IndexedMemProfRecord deserializeV3(const MemProfSchema &Schema,
+ const unsigned char *Ptr) {
+ using namespace support;
+
+ IndexedMemProfRecord Record;
+
+ // Read the meminfo nodes.
+ const uint64_t NumNodes =
+ endian::readNext<uint64_t, llvm::endianness::little>(Ptr);
+ Record.AllocSites.reserve(NumNodes);
+ for (uint64_t I = 0; I < NumNodes; I++) {
+ IndexedAllocationInfo Node;
+ Node.CSId = endian::readNext<uint32_t, llvm::endianness::little>(Ptr);
+ Node.Info.deserialize(Schema, Ptr);
+ Ptr += PortableMemInfoBlock::serializedSize(Schema);
+ Record.AllocSites.push_back(Node);
+ }
+
+ // Read the callsite information.
+ const uint64_t NumCtxs =
+ endian::readNext<uint64_t, llvm::endianness::little>(Ptr);
+ Record.CallSiteIds.reserve(NumCtxs);
+ for (uint64_t J = 0; J < NumCtxs; J++) {
+ CallStackId CSId =
----------------
teresajohnson wrote:
CallStackId is still a typedef to uint64_t. I guess we can't change this completely while we still have v2 around, but it is a little confusing, and presumably using more memory than needed in the in-memory data structures. Should there be a TODO to switch this to 32-bits?
https://github.com/llvm/llvm-project/pull/93924
More information about the llvm-commits
mailing list