[llvm] [MemProf] Add v4 which contains CalleeGuids to CallSiteInfo. (PR #137394)

Mingming Liu via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 25 18:22:36 PDT 2025


================
@@ -216,6 +265,46 @@ static IndexedMemProfRecord deserializeV3(const MemProfSchema &Schema,
   return Record;
 }
 
+static IndexedMemProfRecord deserializeV4(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<LinearCallStackId, llvm::endianness::little>(Ptr);
+    Node.Info.deserialize(Schema, Ptr);
+    Ptr += PortableMemInfoBlock::serializedSize(Schema);
----------------
mingmingl-llvm wrote:

nit: if I read correctly, `PortableMemInfoBlock::serializedSize(Schema)` could be computed once outside of the loop starting at L278.

https://github.com/llvm/llvm-project/pull/137394


More information about the llvm-commits mailing list