[compiler-rt] [llvm] [MemProf] Change histogram storage from uint64_t to uint8_t (PR #147854)
Snehasish Kumar via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 23 17:05:28 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:
I can split this out into a separate change if you would like.
This is not a functional change for little-endian systems. It is not strictly necessary for the changes in v5 but an attempt to make the profile reader more robust. We could support it for v4 too but there isn't much value since the raw profiles we produce after this patch will be v5 and we don't have any v4 profiles stashed somewhere that we need to read in the future (I believe).
https://github.com/llvm/llvm-project/pull/147854
More information about the llvm-commits
mailing list