Skip to content

[memprof] Clean up IndexedMemProfReader (NFC) #94710

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions llvm/include/llvm/ProfileData/InstrProfReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -665,9 +665,8 @@ class IndexedMemProfReader {
const unsigned char *CallStackBase = nullptr;

Error deserializeV012(const unsigned char *Start, const unsigned char *Ptr,
uint64_t FirstWord, memprof::IndexedVersion Version);
Error deserializeV3(const unsigned char *Start, const unsigned char *Ptr,
memprof::IndexedVersion Version);
uint64_t FirstWord);
Error deserializeV3(const unsigned char *Start, const unsigned char *Ptr);

public:
IndexedMemProfReader() = default;
Expand Down
12 changes: 5 additions & 7 deletions llvm/lib/ProfileData/InstrProfReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1204,8 +1204,7 @@ IndexedInstrProfReader::readSummary(IndexedInstrProf::ProfVersion Version,

Error IndexedMemProfReader::deserializeV012(const unsigned char *Start,
const unsigned char *Ptr,
uint64_t FirstWord,
memprof::IndexedVersion Version) {
uint64_t FirstWord) {
// The value returned from RecordTableGenerator.Emit.
const uint64_t RecordTableOffset =
Version == memprof::Version0
Expand Down Expand Up @@ -1259,8 +1258,7 @@ Error IndexedMemProfReader::deserializeV012(const unsigned char *Start,
}

Error IndexedMemProfReader::deserializeV3(const unsigned char *Start,
const unsigned char *Ptr,
memprof::IndexedVersion Version) {
const unsigned char *Ptr) {
// The offset in the stream right before invoking
// CallStackTableGenerator.Emit.
const uint64_t CallStackPayloadOffset =
Expand All @@ -1285,7 +1283,7 @@ Error IndexedMemProfReader::deserializeV3(const unsigned char *Start,
MemProfRecordTable.reset(MemProfRecordHashTable::Create(
/*Buckets=*/Start + RecordTableOffset,
/*Payload=*/Start + RecordPayloadOffset,
/*Base=*/Start, memprof::RecordLookupTrait(Version, Schema)));
/*Base=*/Start, memprof::RecordLookupTrait(memprof::Version3, Schema)));

return Error::success();
}
Expand Down Expand Up @@ -1323,11 +1321,11 @@ Error IndexedMemProfReader::deserialize(const unsigned char *Start,
case memprof::Version0:
case memprof::Version1:
case memprof::Version2:
if (Error E = deserializeV012(Start, Ptr, FirstWord, Version))
if (Error E = deserializeV012(Start, Ptr, FirstWord))
return E;
break;
case memprof::Version3:
if (Error E = deserializeV3(Start, Ptr, Version))
if (Error E = deserializeV3(Start, Ptr))
return E;
break;
}
Expand Down
Loading