summaryrefslogtreecommitdiff
path: root/llvm/lib/ProfileData/InstrProfReader.cpp
diff options
context:
space:
mode:
authorSnehasish Kumar <snehasishk@google.com>2022-02-14 11:40:22 -0800
committerSnehasish Kumar <snehasishk@google.com>2022-02-14 11:42:58 -0800
commit85355a560a33897453df2ef959e255ee725eebce (patch)
treea782a0bd351cc8f1bada8e66ad5ae7d7d232c0d8 /llvm/lib/ProfileData/InstrProfReader.cpp
parent57c3c48e6ee871df7cde4ca08c2f3ac461cbfcf3 (diff)
Revert "Reland "[memprof] Extend the index prof format to include memory profiles.""
This reverts commit de54e4ab78ef09b60f870e8df6f8a87e56d6bd94 [1/4]
Diffstat (limited to 'llvm/lib/ProfileData/InstrProfReader.cpp')
-rw-r--r--llvm/lib/ProfileData/InstrProfReader.cpp43
1 files changed, 1 insertions, 42 deletions
diff --git a/llvm/lib/ProfileData/InstrProfReader.cpp b/llvm/lib/ProfileData/InstrProfReader.cpp
index 39ba004ee879..c45b8cde2cda 100644
--- a/llvm/lib/ProfileData/InstrProfReader.cpp
+++ b/llvm/lib/ProfileData/InstrProfReader.cpp
@@ -19,9 +19,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/IR/ProfileSummary.h"
#include "llvm/ProfileData/InstrProf.h"
-#include "llvm/ProfileData/MemProf.h"
#include "llvm/ProfileData/ProfileCommon.h"
-#include "llvm/ProfileData/RawMemProfReader.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorOr.h"
@@ -59,9 +57,6 @@ static InstrProfKind getProfileKindFromVersion(uint64_t Version) {
if (Version & VARIANT_MASK_FUNCTION_ENTRY_ONLY) {
ProfileKind |= InstrProfKind::FunctionEntryOnly;
}
- if (Version & VARIANT_MASK_MEMPROF) {
- ProfileKind |= InstrProfKind::MemProf;
- }
return ProfileKind;
}
@@ -960,35 +955,10 @@ Error IndexedInstrProfReader::readHeader() {
uint64_t HashOffset = endian::byte_swap<uint64_t, little>(Header->HashOffset);
- // The hash table with profile counts comes next.
+ // The rest of the file is an on disk hash table.
auto IndexPtr = std::make_unique<InstrProfReaderIndex<OnDiskHashTableImplV3>>(
Start + HashOffset, Cur, Start, HashType, Header->Version);
- // The MemProfOffset field in the header is only valid when the format version
- // is higher than 8 (when it was introduced).
- if (GET_VERSION(Header->Version) >= 8 &&
- Header->Version & VARIANT_MASK_MEMPROF) {
- uint64_t MemProfOffset =
- endian::byte_swap<uint64_t, little>(Header->MemProfOffset);
-
- const unsigned char *Ptr = Start + MemProfOffset;
- // The value returned from Generator.Emit.
- const uint64_t TableOffset =
- support::endian::readNext<uint64_t, little, unaligned>(Ptr);
-
- // Read the schema.
- auto SchemaOr = memprof::readMemProfSchema(Ptr);
- if (!SchemaOr)
- return SchemaOr.takeError();
- Schema = SchemaOr.get();
-
- // Now initialize the table reader with a pointer into data buffer.
- MemProfTable.reset(MemProfHashTable::Create(
- /*Buckets=*/Start + TableOffset,
- /*Payload=*/Ptr,
- /*Base=*/Start, memprof::MemProfRecordLookupTrait(Schema)));
- }
-
// Load the remapping table now if requested.
if (RemappingBuffer) {
Remapper = std::make_unique<
@@ -1033,17 +1003,6 @@ IndexedInstrProfReader::getInstrProfRecord(StringRef FuncName,
return error(instrprof_error::hash_mismatch);
}
-Expected<ArrayRef<memprof::MemProfRecord>>
-IndexedInstrProfReader::getMemProfRecord(uint64_t FuncNameHash) {
- auto Iter = MemProfTable->find(FuncNameHash);
- if (Iter == MemProfTable->end())
- // TODO: Add memprof specific errors.
- return make_error<InstrProfError>(instrprof_error::hash_mismatch,
- "memprof record not found for hash " +
- Twine(FuncNameHash));
- return *Iter;
-}
-
Error IndexedInstrProfReader::getFunctionCounts(StringRef FuncName,
uint64_t FuncHash,
std::vector<uint64_t> &Counts) {