summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ProfileData
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2016-01-14 02:47:01 +0000
committerXinliang David Li <davidxl@google.com>2016-01-14 02:47:01 +0000
commita6b2c4f721f4243d4b39f1ab02bbdc986002afdc (patch)
treed00cedf098f2558dce79e9ceb1d533ba2f1bed75 /llvm/lib/ProfileData
parent4b35874b2a9e8efc8e3123726bc611030d382ecf (diff)
downloadbcm5719-llvm-a6b2c4f721f4243d4b39f1ab02bbdc986002afdc.tar.gz
bcm5719-llvm-a6b2c4f721f4243d4b39f1ab02bbdc986002afdc.zip
[PGO] clean up and documentation
Introduce enum for indexed format versions and document indexed format change history. llvm-svn: 257737
Diffstat (limited to 'llvm/lib/ProfileData')
-rw-r--r--llvm/lib/ProfileData/InstrProfReader.cpp7
-rw-r--r--llvm/lib/ProfileData/InstrProfWriter.cpp2
2 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/ProfileData/InstrProfReader.cpp b/llvm/lib/ProfileData/InstrProfReader.cpp
index 5e83456822f..7e9b7ab7c8a 100644
--- a/llvm/lib/ProfileData/InstrProfReader.cpp
+++ b/llvm/lib/ProfileData/InstrProfReader.cpp
@@ -478,7 +478,7 @@ data_type InstrProfLookupTrait::ReadData(StringRef K, const unsigned char *D,
// Initialize number of counters for FormatVersion == 1.
uint64_t CountsSize = N / sizeof(uint64_t) - 1;
// If format version is different then read the number of counters.
- if (FormatVersion != 1) {
+ if (FormatVersion != IndexedInstrProf::ProfVersion::Version1) {
if (D + sizeof(uint64_t) > End)
return data_type();
CountsSize = endian::readNext<uint64_t, little, unaligned>(D);
@@ -495,7 +495,8 @@ data_type InstrProfLookupTrait::ReadData(StringRef K, const unsigned char *D,
DataBuffer.emplace_back(K, Hash, std::move(CounterBuffer));
// Read value profiling data.
- if (FormatVersion > 2 && !readValueProfilingData(D, End)) {
+ if (FormatVersion > IndexedInstrProf::ProfVersion::Version2 &&
+ !readValueProfilingData(D, End)) {
DataBuffer.clear();
return data_type();
}
@@ -572,7 +573,7 @@ std::error_code IndexedInstrProfReader::readHeader() {
// Read the version.
uint64_t FormatVersion = endian::byte_swap<uint64_t, little>(Header->Version);
- if (FormatVersion > IndexedInstrProf::Version)
+ if (FormatVersion > IndexedInstrProf::ProfVersion::CurrentVersion)
return error(instrprof_error::unsupported_version);
// Read the maximal function count.
diff --git a/llvm/lib/ProfileData/InstrProfWriter.cpp b/llvm/lib/ProfileData/InstrProfWriter.cpp
index f5227248af2..44ad016f1a8 100644
--- a/llvm/lib/ProfileData/InstrProfWriter.cpp
+++ b/llvm/lib/ProfileData/InstrProfWriter.cpp
@@ -140,7 +140,7 @@ std::pair<uint64_t, uint64_t> InstrProfWriter::writeImpl(raw_ostream &OS) {
// Write the header.
IndexedInstrProf::Header Header;
Header.Magic = IndexedInstrProf::Magic;
- Header.Version = IndexedInstrProf::Version;
+ Header.Version = IndexedInstrProf::ProfVersion::CurrentVersion;
Header.MaxFunctionCount = MaxFunctionCount;
Header.HashType = static_cast<uint64_t>(IndexedInstrProf::HashType);
Header.HashOffset = 0;
OpenPOWER on IntegriCloud