aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ProfileData/InstrProfReader.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-05-28 13:30:00 -0700
committerGitHub <noreply@github.com>2024-05-28 13:30:00 -0700
commit9e89d107a6ec2ade15eddb549fa473cf09bf230e (patch)
tree8b44fab72ed14e2426d71b42573b7d333f8fc7d3 /llvm/lib/ProfileData/InstrProfReader.cpp
parentc108c1e94580d70e2be66172ab4397fcff004376 (diff)
downloadllvm-9e89d107a6ec2ade15eddb549fa473cf09bf230e.zip
llvm-9e89d107a6ec2ade15eddb549fa473cf09bf230e.tar.gz
llvm-9e89d107a6ec2ade15eddb549fa473cf09bf230e.tar.bz2
[memprof] Add MemProf format Version 3 (#93608)
This patch adds Version 3 for development purposes. For now, this patch adds V3 as a copy of V2. For the most part, this patch adds "case Version3:" wherever "case Version2:" appears. One exception is writeMemProfV3, which is copied from writeMemProfV2 but updated to write out memprof::Version3 to the MemProf header. We'll incrementally modify writeMemProfV3 in subsequent patches.
Diffstat (limited to 'llvm/lib/ProfileData/InstrProfReader.cpp')
-rw-r--r--llvm/lib/ProfileData/InstrProfReader.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/ProfileData/InstrProfReader.cpp b/llvm/lib/ProfileData/InstrProfReader.cpp
index 836206a..798236c 100644
--- a/llvm/lib/ProfileData/InstrProfReader.cpp
+++ b/llvm/lib/ProfileData/InstrProfReader.cpp
@@ -1212,7 +1212,8 @@ Error IndexedMemProfReader::deserialize(const unsigned char *Start,
const uint64_t FirstWord =
support::endian::readNext<uint64_t, llvm::endianness::little>(Ptr);
- if (FirstWord == memprof::Version1 || FirstWord == memprof::Version2) {
+ if (FirstWord == memprof::Version1 || FirstWord == memprof::Version2 ||
+ FirstWord == memprof::Version3) {
// Everything is good. We can proceed to deserialize the rest.
Version = static_cast<memprof::IndexedVersion>(FirstWord);
} else if (FirstWord >= 24) {
@@ -1559,6 +1560,7 @@ IndexedMemProfReader::getMemProfRecord(const uint64_t FuncNameHash) const {
"MemProfCallStackTable must not be available");
return getMemProfRecordV0(IndexedRecord, *MemProfFrameTable);
case memprof::Version2:
+ case memprof::Version3:
assert(MemProfFrameTable && "MemProfFrameTable must be available");
assert(MemProfCallStackTable && "MemProfCallStackTable must be available");
return getMemProfRecordV2(IndexedRecord, *MemProfFrameTable,