From: Amir Ayupov Date: Wed, 25 Jan 2023 19:37:42 +0000 (-0800) Subject: [BOLT] Emit a warning about invalid entries in function-order list X-Git-Tag: upstream/17.0.6~19597 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e20074053da8cfad101f2752fd2e8fb0224ec21c;p=platform%2Fupstream%2Fllvm.git [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 --- diff --git a/bolt/lib/Passes/ReorderFunctions.cpp b/bolt/lib/Passes/ReorderFunctions.cpp index 998e0ea..becaadd 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 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; }