aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/lib/ProfileData/InstrProfReader.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2021-06-13 19:31:46 +0000
committerDimitry Andric <dim@FreeBSD.org>2021-07-31 18:56:55 +0000
commitaf732203b8f7f006927528db5497f5cbc4c4742a (patch)
tree596f112de3b76118552871dbb6114bb7e3e17f40 /contrib/llvm-project/llvm/lib/ProfileData/InstrProfReader.cpp
parent83dea422ac8d4a8323e64203c2eadaa813768717 (diff)
Diffstat (limited to 'contrib/llvm-project/llvm/lib/ProfileData/InstrProfReader.cpp')
-rw-r--r--contrib/llvm-project/llvm/lib/ProfileData/InstrProfReader.cpp36
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();
}