Skip to content
This repository has been archived by the owner on Jul 1, 2023. It is now read-only.

Commit

Permalink
[perf2bolt] Accept - as a valid misprediction symbol
Browse files Browse the repository at this point in the history
Summary:
As reported in GH-28 `perf` can produce `-` symbol for misprediction bit
if the bit is not supported by the kernel/HW. In this case we can ignore
the bit.

(cherry picked from commit 0a4ad831e49388ccc49ae15ecdb51c58b6eaafff)
  • Loading branch information
maksfb authored and aaupov committed May 12, 2021
1 parent 4b3849b commit 9886aa5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion bolt/src/DataAggregator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -653,13 +653,19 @@ ErrorOr<LBREntry> DataAggregator::parseLBREntry() {
return EC;
StringRef MispredStr = MispredStrRes.get();
if (MispredStr.size() != 1 ||
(MispredStr[0] != 'P' && MispredStr[0] != 'M')) {
(MispredStr[0] != 'P' && MispredStr[0] != 'M' && MispredStr[0] != '-')) {
reportError("expected single char for mispred bit");
Diag << "Found: " << MispredStr << "\n";
return make_error_code(llvm::errc::io_error);
}
Res.Mispred = MispredStr[0] == 'M';

static bool MispredWarning = true;;
if (MispredStr[0] == '-' && MispredWarning) {
errs() << "PERF2BOLT-WARNING: misprediction bit is missing in profile\n";
MispredWarning = false;
}

auto Rest = parseString(FieldSeparator, true);
if (std::error_code EC = Rest.getError())
return EC;
Expand Down
2 changes: 1 addition & 1 deletion bolt/src/DataReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ DataReader::readPerfData(StringRef Path, raw_ostream &Diag) {
}

void DataReader::reportError(StringRef ErrorMsg) {
Diag << "Error reading bolt data input file: line " << Line << ", column "
Diag << "Error reading BOLT data input file: line " << Line << ", column "
<< Col << ": " << ErrorMsg << '\n';
}

Expand Down

0 comments on commit 9886aa5

Please sign in to comment.