aboutsummaryrefslogtreecommitdiff
path: root/bolt
diff options
context:
space:
mode:
Diffstat (limited to 'bolt')
-rw-r--r--bolt/include/bolt/Core/BinaryContext.h5
-rw-r--r--bolt/include/bolt/Passes/MarkRAStates.h5
-rw-r--r--bolt/lib/Passes/BinaryPasses.cpp17
-rw-r--r--bolt/lib/Passes/MarkRAStates.cpp5
-rw-r--r--bolt/lib/Profile/YAMLProfileReader.cpp3
5 files changed, 9 insertions, 26 deletions
diff --git a/bolt/include/bolt/Core/BinaryContext.h b/bolt/include/bolt/Core/BinaryContext.h
index 8960b19..5cbc28f 100644
--- a/bolt/include/bolt/Core/BinaryContext.h
+++ b/bolt/include/bolt/Core/BinaryContext.h
@@ -781,11 +781,6 @@ public:
uint64_t PseudoProbeLooseMatchedSampleCount{0};
/// the count of call matched samples
uint64_t CallMatchedSampleCount{0};
- /// the number of stale functions that have matching number of blocks in
- /// the profile
- uint64_t NumStaleFuncsWithEqualBlockCount{0};
- /// the number of blocks that have matching size but a differing hash
- uint64_t NumStaleBlocksWithEqualIcount{0};
} Stats;
// Original binary execution count stats.
diff --git a/bolt/include/bolt/Passes/MarkRAStates.h b/bolt/include/bolt/Passes/MarkRAStates.h
index 675ab97..202f1dd 100644
--- a/bolt/include/bolt/Passes/MarkRAStates.h
+++ b/bolt/include/bolt/Passes/MarkRAStates.h
@@ -13,11 +13,16 @@
#define BOLT_PASSES_MARK_RA_STATES
#include "bolt/Passes/BinaryPasses.h"
+#include <mutex>
namespace llvm {
namespace bolt {
class MarkRAStates : public BinaryFunctionPass {
+ // setIgnored() is not thread-safe, but the pass is running on functions in
+ // parallel.
+ std::mutex IgnoreMutex;
+
public:
explicit MarkRAStates() : BinaryFunctionPass(false) {}
diff --git a/bolt/lib/Passes/BinaryPasses.cpp b/bolt/lib/Passes/BinaryPasses.cpp
index e1a1856..1d187de 100644
--- a/bolt/lib/Passes/BinaryPasses.cpp
+++ b/bolt/lib/Passes/BinaryPasses.cpp
@@ -1508,12 +1508,6 @@ Error PrintProgramStats::runOnFunctions(BinaryContext &BC) {
if (NumAllStaleFunctions) {
const float PctStale =
NumAllStaleFunctions / (float)NumAllProfiledFunctions * 100.0f;
- const float PctStaleFuncsWithEqualBlockCount =
- (float)BC.Stats.NumStaleFuncsWithEqualBlockCount /
- NumAllStaleFunctions * 100.0f;
- const float PctStaleBlocksWithEqualIcount =
- (float)BC.Stats.NumStaleBlocksWithEqualIcount /
- BC.Stats.NumStaleBlocks * 100.0f;
auto printErrorOrWarning = [&]() {
if (PctStale > opts::StaleThreshold)
BC.errs() << "BOLT-ERROR: ";
@@ -1536,17 +1530,6 @@ Error PrintProgramStats::runOnFunctions(BinaryContext &BC) {
<< "%) belong to functions with invalid"
" (possibly stale) profile.\n";
}
- BC.outs() << "BOLT-INFO: " << BC.Stats.NumStaleFuncsWithEqualBlockCount
- << " stale function"
- << (BC.Stats.NumStaleFuncsWithEqualBlockCount == 1 ? "" : "s")
- << format(" (%.1f%% of all stale)",
- PctStaleFuncsWithEqualBlockCount)
- << " have matching block count.\n";
- BC.outs() << "BOLT-INFO: " << BC.Stats.NumStaleBlocksWithEqualIcount
- << " stale block"
- << (BC.Stats.NumStaleBlocksWithEqualIcount == 1 ? "" : "s")
- << format(" (%.1f%% of all stale)", PctStaleBlocksWithEqualIcount)
- << " have matching icount.\n";
if (PctStale > opts::StaleThreshold) {
return createFatalBOLTError(
Twine("BOLT-ERROR: stale functions exceed specified threshold of ") +
diff --git a/bolt/lib/Passes/MarkRAStates.cpp b/bolt/lib/Passes/MarkRAStates.cpp
index af6a5ca7..b262d66 100644
--- a/bolt/lib/Passes/MarkRAStates.cpp
+++ b/bolt/lib/Passes/MarkRAStates.cpp
@@ -43,10 +43,11 @@ bool MarkRAStates::runOnFunction(BinaryFunction &BF) {
// Not all functions have .cfi_negate_ra_state in them. But if one does,
// we expect psign/pauth instructions to have the hasNegateRAState
// annotation.
- BF.setIgnored();
BC.outs() << "BOLT-INFO: inconsistent RAStates in function "
<< BF.getPrintName()
<< ": ptr sign/auth inst without .cfi_negate_ra_state\n";
+ std::lock_guard<std::mutex> Lock(IgnoreMutex);
+ BF.setIgnored();
return false;
}
}
@@ -67,6 +68,7 @@ bool MarkRAStates::runOnFunction(BinaryFunction &BF) {
BC.outs() << "BOLT-INFO: inconsistent RAStates in function "
<< BF.getPrintName()
<< ": ptr signing inst encountered in Signed RA state\n";
+ std::lock_guard<std::mutex> Lock(IgnoreMutex);
BF.setIgnored();
return false;
}
@@ -80,6 +82,7 @@ bool MarkRAStates::runOnFunction(BinaryFunction &BF) {
<< BF.getPrintName()
<< ": ptr authenticating inst encountered in Unsigned RA "
"state\n";
+ std::lock_guard<std::mutex> Lock(IgnoreMutex);
BF.setIgnored();
return false;
}
diff --git a/bolt/lib/Profile/YAMLProfileReader.cpp b/bolt/lib/Profile/YAMLProfileReader.cpp
index 086e47b..f0f87f9 100644
--- a/bolt/lib/Profile/YAMLProfileReader.cpp
+++ b/bolt/lib/Profile/YAMLProfileReader.cpp
@@ -350,9 +350,6 @@ bool YAMLProfileReader::parseFunctionProfile(
<< MismatchedCalls << " calls, and " << MismatchedEdges
<< " edges in profile did not match function " << BF << '\n';
- if (YamlBF.NumBasicBlocks != BF.size())
- ++BC.Stats.NumStaleFuncsWithEqualBlockCount;
-
if (!opts::InferStaleProfile)
return false;
ArrayRef<ProbeMatchSpec> ProbeMatchSpecs;