[BOLT][NFC] Change wording while reporting functions stats

Summary:

(cherry picked from FBD21242167)
This commit is contained in:
Maksim Panchenko 2020-04-24 16:36:22 -07:00
parent fbca177a83
commit ac1af09e82
1 changed files with 18 additions and 9 deletions

View File

@ -1258,7 +1258,7 @@ void PrintProfileStats::runOnFunctions(BinaryContext &BC) {
void void
PrintProgramStats::runOnFunctions(BinaryContext &BC) { PrintProgramStats::runOnFunctions(BinaryContext &BC) {
uint64_t NumSimpleFunctions{0}; uint64_t NumRegularFunctions{0};
uint64_t NumStaleProfileFunctions{0}; uint64_t NumStaleProfileFunctions{0};
uint64_t NumNonSimpleProfiledFunctions{0}; uint64_t NumNonSimpleProfiledFunctions{0};
uint64_t NumUnknownControlFlowFunctions{0}; uint64_t NumUnknownControlFlowFunctions{0};
@ -1266,13 +1266,20 @@ PrintProgramStats::runOnFunctions(BinaryContext &BC) {
const char *StaleFuncsHeader = "BOLT-INFO: Functions with stale profile:\n"; const char *StaleFuncsHeader = "BOLT-INFO: Functions with stale profile:\n";
for (auto &BFI : BC.getBinaryFunctions()) { for (auto &BFI : BC.getBinaryFunctions()) {
auto &Function = BFI.second; auto &Function = BFI.second;
// Ignore PLT functions for stats.
if (Function.isPLTFunction())
continue;
++NumRegularFunctions;
if (!Function.isSimple()) { if (!Function.isSimple()) {
if (Function.hasProfile() && !Function.isPLTFunction()) { if (Function.hasProfile()) {
++NumNonSimpleProfiledFunctions; ++NumNonSimpleProfiledFunctions;
} }
continue; continue;
} }
++NumSimpleFunctions;
if (Function.hasUnknownControlFlow()) { if (Function.hasUnknownControlFlow()) {
if (opts::PrintUnknownCFG) { if (opts::PrintUnknownCFG) {
Function.dump(); Function.dump();
@ -1281,8 +1288,10 @@ PrintProgramStats::runOnFunctions(BinaryContext &BC) {
} }
++NumUnknownControlFlowFunctions; ++NumUnknownControlFlowFunctions;
} }
if (!Function.hasProfile()) if (!Function.hasProfile())
continue; continue;
if (Function.hasValidProfile()) { if (Function.hasValidProfile()) {
ProfiledFunctions.push_back(&Function); ProfiledFunctions.push_back(&Function);
} else { } else {
@ -1298,15 +1307,15 @@ PrintProgramStats::runOnFunctions(BinaryContext &BC) {
const auto NumAllProfiledFunctions = const auto NumAllProfiledFunctions =
ProfiledFunctions.size() + NumStaleProfileFunctions; ProfiledFunctions.size() + NumStaleProfileFunctions;
outs() << "BOLT-INFO: " outs() << "BOLT-INFO: " << NumAllProfiledFunctions
<< NumAllProfiledFunctions << " out of " << NumRegularFunctions << " functions in the binary ("
<< " functions out of " << NumSimpleFunctions << " simple functions ("
<< format("%.1f", NumAllProfiledFunctions / << format("%.1f", NumAllProfiledFunctions /
(float) NumSimpleFunctions * 100.0f) (float) NumRegularFunctions * 100.0f)
<< "%) have non-empty execution profile.\n"; << "%) have non-empty execution profile\n";
if (NumNonSimpleProfiledFunctions) { if (NumNonSimpleProfiledFunctions) {
outs() << "BOLT-INFO: " << NumNonSimpleProfiledFunctions outs() << "BOLT-INFO: " << NumNonSimpleProfiledFunctions
<< " non-simple function(s) have profile.\n"; << " function" << (NumNonSimpleProfiledFunctions == 1 ? "" : "s")
<< " with profile could not be optimized\n";
} }
if (NumStaleProfileFunctions) { if (NumStaleProfileFunctions) {
const float PctStale = const float PctStale =