Skip to content

Commit 20cb2ed

Browse files
committed
Revert b28f4d4 "[memprof] Omit the key length for the record table (#89527)"
Breaks on EXPENSIVE_CHECKS builds which still use the static ReadKeyDataLength implementation in several locations
1 parent f220c35 commit 20cb2ed

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

llvm/include/llvm/ProfileData/MemProf.h

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -471,16 +471,12 @@ class RecordLookupTrait {
471471

472472
hash_value_type ComputeHash(uint64_t K) { return K; }
473473

474-
std::pair<offset_type, offset_type>
474+
static std::pair<offset_type, offset_type>
475475
ReadKeyDataLength(const unsigned char *&D) {
476476
using namespace support;
477477

478-
// Starting with Version2, we don't read the key length because it is a
479-
// constant.
480478
offset_type KeyLen =
481-
Version < Version2
482-
? endian::readNext<offset_type, llvm::endianness::little>(D)
483-
: sizeof(uint64_t);
479+
endian::readNext<offset_type, llvm::endianness::little>(D);
484480
offset_type DataLen =
485481
endian::readNext<offset_type, llvm::endianness::little>(D);
486482
return std::make_pair(KeyLen, DataLen);
@@ -538,9 +534,7 @@ class RecordWriterTrait {
538534

539535
endian::Writer LE(Out, llvm::endianness::little);
540536
offset_type N = sizeof(K);
541-
// Starting with Version2, we omit the key length because it is a constant.
542-
if (Version < Version2)
543-
LE.write<offset_type>(N);
537+
LE.write<offset_type>(N);
544538
offset_type M = V.serializedSize(Version);
545539
LE.write<offset_type>(M);
546540
return std::make_pair(N, M);

llvm/include/llvm/Support/OnDiskHashTable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ template <typename Info> class OnDiskChainedHashTable {
377377

378378
// Determine the length of the key and the data.
379379
const std::pair<offset_type, offset_type> &L =
380-
InfoPtr->ReadKeyDataLength(Items);
380+
Info::ReadKeyDataLength(Items);
381381
offset_type ItemLen = L.first + L.second;
382382

383383
// Compare the hashes. If they are not the same, skip the entry entirely.

0 commit comments

Comments
 (0)