diff options
author | Simon Pilgrim <git@redking.me.uk> | 2024-04-23 09:59:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-23 09:59:45 +0100 |
commit | 686baf6093643127f87f7cbfd009abcaa11ea0a3 (patch) | |
tree | ed3d4518b7c468146692c745906bbf74e2ca2ef4 | |
parent | a22ffe54a33035d95ee239a11b4dc771f66d102b (diff) |
Revert "[memprof] Omit the key length for the record table (#89527)"upstream/revert-89527-pr_memprof_omit_key_record
This reverts commit b28f4d4dd0bbf50059cb19ca794af967374e1900.
-rw-r--r-- | llvm/include/llvm/ProfileData/MemProf.h | 12 | ||||
-rw-r--r-- | llvm/include/llvm/Support/OnDiskHashTable.h | 2 |
2 files changed, 4 insertions, 10 deletions
diff --git a/llvm/include/llvm/ProfileData/MemProf.h b/llvm/include/llvm/ProfileData/MemProf.h index f356e3a54a36..aa6cdf198485 100644 --- a/llvm/include/llvm/ProfileData/MemProf.h +++ b/llvm/include/llvm/ProfileData/MemProf.h @@ -471,16 +471,12 @@ public: hash_value_type ComputeHash(uint64_t K) { return K; } - std::pair<offset_type, offset_type> + static std::pair<offset_type, offset_type> ReadKeyDataLength(const unsigned char *&D) { using namespace support; - // Starting with Version2, we don't read the key length because it is a - // constant. offset_type KeyLen = - Version < Version2 - ? endian::readNext<offset_type, llvm::endianness::little>(D) - : sizeof(uint64_t); + endian::readNext<offset_type, llvm::endianness::little>(D); offset_type DataLen = endian::readNext<offset_type, llvm::endianness::little>(D); return std::make_pair(KeyLen, DataLen); @@ -538,9 +534,7 @@ public: endian::Writer LE(Out, llvm::endianness::little); offset_type N = sizeof(K); - // Starting with Version2, we omit the key length because it is a constant. - if (Version < Version2) - LE.write<offset_type>(N); + LE.write<offset_type>(N); offset_type M = V.serializedSize(Version); LE.write<offset_type>(M); return std::make_pair(N, M); diff --git a/llvm/include/llvm/Support/OnDiskHashTable.h b/llvm/include/llvm/Support/OnDiskHashTable.h index b6dbea53f3da..f6b4055e74de 100644 --- a/llvm/include/llvm/Support/OnDiskHashTable.h +++ b/llvm/include/llvm/Support/OnDiskHashTable.h @@ -377,7 +377,7 @@ public: // Determine the length of the key and the data. const std::pair<offset_type, offset_type> &L = - InfoPtr->ReadKeyDataLength(Items); + Info::ReadKeyDataLength(Items); offset_type ItemLen = L.first + L.second; // Compare the hashes. If they are not the same, skip the entry entirely. |