summaryrefslogtreecommitdiff
path: root/lib/ProfileData/InstrProfReader.cpp
diff options
context:
space:
mode:
authorRong Xu <xur@google.com>2016-02-08 23:11:16 +0000
committerRong Xu <xur@google.com>2016-02-08 23:11:16 +0000
commitaab8d7f3e362a2a5f87772571a9a15185d12240e (patch)
treeb0c169131d25135f7204da971d224e8226e6a51a /lib/ProfileData/InstrProfReader.cpp
parent08d1cff7c6c4c9b2b2e141147942ab473d26d7df (diff)
[PGO] Revert r260146 as it breaks Darwin platforms.
r260146 | xur | 2016-02-08 13:07:46 -0800 (Mon, 08 Feb 2016) | 13 lines [PGO] Differentiate Clang instrumentation and IR level instrumentation profiles git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260170 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ProfileData/InstrProfReader.cpp')
-rw-r--r--lib/ProfileData/InstrProfReader.cpp30
1 files changed, 5 insertions, 25 deletions
diff --git a/lib/ProfileData/InstrProfReader.cpp b/lib/ProfileData/InstrProfReader.cpp
index 7968cf1f60d..f189713c77a 100644
--- a/lib/ProfileData/InstrProfReader.cpp
+++ b/lib/ProfileData/InstrProfReader.cpp
@@ -109,26 +109,8 @@ bool TextInstrProfReader::hasFormat(const MemoryBuffer &Buffer) {
[](char c) { return ::isprint(c) || ::isspace(c); });
}
-// Read the profile variant flag from the header: ":FE" means this is a FE
-// generated profile. ":IR" means this is an IR level profile. Other strings
-// with a leading ':' will be reported an error format.
std::error_code TextInstrProfReader::readHeader() {
Symtab.reset(new InstrProfSymtab());
- bool IsIRInstr = false;
- if (!Line->startswith(":")) {
- IsIRLevelProfile = false;
- return success();
- }
- StringRef Str = (Line)->substr(1);
- if (Str.equals_lower("ir"))
- IsIRInstr = true;
- else if (Str.equals_lower("fe"))
- IsIRInstr = false;
- else
- return instrprof_error::bad_header;
-
- ++Line;
- IsIRLevelProfile = IsIRInstr;
return success();
}
@@ -311,8 +293,7 @@ void RawInstrProfReader<IntPtrT>::createSymtab(InstrProfSymtab &Symtab) {
template <class IntPtrT>
std::error_code
RawInstrProfReader<IntPtrT>::readHeader(const RawInstrProf::Header &Header) {
- Version = swap(Header.Version);
- if (GET_VERSION(Version) != RawInstrProf::Version)
+ if (swap(Header.Version) != RawInstrProf::Version)
return error(instrprof_error::unsupported_version);
CountersDelta = swap(Header.CountersDelta);
@@ -489,10 +470,10 @@ data_type InstrProfLookupTrait::ReadData(StringRef K, const unsigned char *D,
return data_type();
uint64_t Hash = endian::readNext<uint64_t, little, unaligned>(D);
- // Initialize number of counters for GET_VERSION(FormatVersion) == 1.
+ // 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 (GET_VERSION(FormatVersion) != IndexedInstrProf::ProfVersion::Version1) {
+ if (FormatVersion != IndexedInstrProf::ProfVersion::Version1) {
if (D + sizeof(uint64_t) > End)
return data_type();
CountsSize = endian::readNext<uint64_t, little, unaligned>(D);
@@ -509,7 +490,7 @@ data_type InstrProfLookupTrait::ReadData(StringRef K, const unsigned char *D,
DataBuffer.emplace_back(K, Hash, std::move(CounterBuffer));
// Read value profiling data.
- if (GET_VERSION(FormatVersion) > IndexedInstrProf::ProfVersion::Version2 &&
+ if (FormatVersion > IndexedInstrProf::ProfVersion::Version2 &&
!readValueProfilingData(D, End)) {
DataBuffer.clear();
return data_type();
@@ -622,8 +603,7 @@ std::error_code IndexedInstrProfReader::readHeader() {
// Read the version.
uint64_t FormatVersion = endian::byte_swap<uint64_t, little>(Header->Version);
- if (GET_VERSION(FormatVersion) >
- IndexedInstrProf::ProfVersion::CurrentVersion)
+ if (FormatVersion > IndexedInstrProf::ProfVersion::CurrentVersion)
return error(instrprof_error::unsupported_version);
Cur = readSummary((IndexedInstrProf::ProfVersion)FormatVersion, Cur);