diff options
Diffstat (limited to 'contrib/llvm-project/llvm/lib/ProfileData/InstrProfReader.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/ProfileData/InstrProfReader.cpp | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/contrib/llvm-project/llvm/lib/ProfileData/InstrProfReader.cpp b/contrib/llvm-project/llvm/lib/ProfileData/InstrProfReader.cpp index 16a69cb5457b..9581e5b486a6 100644 --- a/contrib/llvm-project/llvm/lib/ProfileData/InstrProfReader.cpp +++ b/contrib/llvm-project/llvm/lib/ProfileData/InstrProfReader.cpp @@ -154,23 +154,29 @@ bool TextInstrProfReader::hasFormat(const MemoryBuffer &Buffer) { Error TextInstrProfReader::readHeader() { Symtab.reset(new InstrProfSymtab()); bool IsIRInstr = false; - if (!Line->startswith(":")) { - IsIRLevelProfile = false; - return success(); + bool IsEntryFirst = false; + bool IsCS = false; + + while (Line->startswith(":")) { + StringRef Str = Line->substr(1); + if (Str.equals_lower("ir")) + IsIRInstr = true; + else if (Str.equals_lower("fe")) + IsIRInstr = false; + else if (Str.equals_lower("csir")) { + IsIRInstr = true; + IsCS = true; + } else if (Str.equals_lower("entry_first")) + IsEntryFirst = true; + else if (Str.equals_lower("not_entry_first")) + IsEntryFirst = false; + else + return error(instrprof_error::bad_header); + ++Line; } - StringRef Str = (Line)->substr(1); - if (Str.equals_lower("ir")) - IsIRInstr = true; - else if (Str.equals_lower("fe")) - IsIRInstr = false; - else if (Str.equals_lower("csir")) { - IsIRInstr = true; - HasCSIRLevelProfile = true; - } else - return error(instrprof_error::bad_header); - - ++Line; IsIRLevelProfile = IsIRInstr; + InstrEntryBBEnabled = IsEntryFirst; + HasCSIRLevelProfile = IsCS; return success(); } |