diff options
author | Amir Ayupov <aaupov@fb.com> | 2023-01-25 11:37:42 -0800 |
---|---|---|
committer | Amir Ayupov <aaupov@fb.com> | 2023-01-25 11:43:06 -0800 |
commit | e20074053da8cfad101f2752fd2e8fb0224ec21c (patch) | |
tree | 29e8d62b0c3ef85a408efc262b19479b4a3bdd19 /bolt | |
parent | 9916ab03f19dc50c688b8567ac0d30b4a6615f9d (diff) | |
download | llvm-e20074053da8cfad101f2752fd2e8fb0224ec21c.tar.gz |
[BOLT] Emit a warning about invalid entries in function-order list
Move individual warnings under verbosity >= 1, print out a warning with
aggregate number.
Reviewed By: #bolt, rafauler
Differential Revision: https://reviews.llvm.org/D142397
Diffstat (limited to 'bolt')
-rw-r--r-- | bolt/lib/Passes/ReorderFunctions.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/bolt/lib/Passes/ReorderFunctions.cpp b/bolt/lib/Passes/ReorderFunctions.cpp index 998e0eab66fa..becaaddea969 100644 --- a/bolt/lib/Passes/ReorderFunctions.cpp +++ b/bolt/lib/Passes/ReorderFunctions.cpp @@ -333,6 +333,7 @@ void ReorderFunctions::runOnFunctions(BinaryContext &BC) { case RT_USER: { uint32_t Index = 0; + uint32_t InvalidEntries = 0; for (const std::string &Function : readFunctionOrderFile()) { std::vector<uint64_t> FuncAddrs; @@ -355,8 +356,10 @@ void ReorderFunctions::runOnFunctions(BinaryContext &BC) { } if (FuncAddrs.empty()) { - errs() << "BOLT-WARNING: Reorder functions: can't find function for " - << Function << ".\n"; + if (opts::Verbosity >= 1) + errs() << "BOLT-WARNING: Reorder functions: can't find function " + << "for " << Function << "\n"; + ++InvalidEntries; continue; } @@ -366,17 +369,22 @@ void ReorderFunctions::runOnFunctions(BinaryContext &BC) { BinaryFunction *BF = BC.getFunctionForSymbol(FuncBD->getSymbol()); if (!BF) { - errs() << "BOLT-WARNING: Reorder functions: can't find function for " - << Function << ".\n"; + if (opts::Verbosity >= 1) + errs() << "BOLT-WARNING: Reorder functions: can't find function " + << "for " << Function << "\n"; + ++InvalidEntries; break; } if (!BF->hasValidIndex()) BF->setIndex(Index++); else if (opts::Verbosity > 0) errs() << "BOLT-WARNING: Duplicate reorder entry for " << Function - << ".\n"; + << "\n"; } } + if (InvalidEntries) + errs() << "BOLT-WARNING: Reorder functions: can't find functions for " + << InvalidEntries << " entries in -function-order list\n"; } break; } |