[compiler-rt] [llvm] [MemProf] Change histogram storage from uint64_t to uint16_t (PR #147854)

Snehasish Kumar via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 23 23:17:21 PDT 2025


================
@@ -166,6 +166,68 @@ readMemInfoBlocksV4(const char *Ptr) {
   return Items;
 }
 
+llvm::SmallVector<std::pair<uint64_t, MemInfoBlock>>
+readMemInfoBlocksV5(const char *Ptr) {
+  using namespace support;
+
+  const uint64_t NumItemsToRead =
+      endian::readNext<uint64_t, llvm::endianness::little, unaligned>(Ptr);
+
+  llvm::SmallVector<std::pair<uint64_t, MemInfoBlock>> Items;
+  for (uint64_t I = 0; I < NumItemsToRead; I++) {
+    const uint64_t Id =
+        endian::readNext<uint64_t, llvm::endianness::little, unaligned>(Ptr);
+
+    MemInfoBlock MIB;
+#define READ_MIB_FIELD(FIELD)                                                  \
+  MIB.FIELD = endian::readNext<decltype(MIB.FIELD), llvm::endianness::little,  \
----------------
snehasish wrote:

After some thought, I split out this part into a separate PR (and also updated the writer too).

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


More information about the llvm-commits mailing list