diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2021-06-13 19:31:46 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2021-07-31 18:56:55 +0000 | 
| commit | af732203b8f7f006927528db5497f5cbc4c4742a (patch) | |
| tree | 596f112de3b76118552871dbb6114bb7e3e17f40 /contrib/llvm-project/llvm/lib/ProfileData/InstrProfReader.cpp | |
| parent | 83dea422ac8d4a8323e64203c2eadaa813768717 (diff) | |
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();  }  | 
