[PATCH] D142397: [BOLT] Emit a warning about invalid entries in function-order list
Amir Ayupov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 23 12:41:46 PST 2023
Amir created this revision.
Amir added a reviewer: bolt.
Herald added a reviewer: rafauler.
Herald added subscribers: treapster, ayermolo.
Herald added a reviewer: maksfb.
Herald added a project: All.
Amir requested review of this revision.
Herald added subscribers: llvm-commits, yota9.
Herald added a project: LLVM.
Move individual warnings under verbosity >= 1, print out a warning with
aggregate number.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D142397
Files:
bolt/lib/Passes/ReorderFunctions.cpp
bolt/lib/Rewrite/RewriteInstance.cpp
Index: bolt/lib/Rewrite/RewriteInstance.cpp
===================================================================
--- bolt/lib/Rewrite/RewriteInstance.cpp
+++ bolt/lib/Rewrite/RewriteInstance.cpp
@@ -2756,10 +2756,14 @@
LiteThresholdExecCount, static_cast<uint64_t>(opts::LiteThresholdCount));
StringSet<> ReorderFunctionsUserSet;
+ StringSet<> ReorderFunctionsLTOCommonSet;
if (opts::ReorderFunctions == ReorderFunctions::RT_USER) {
for (const std::string &Function :
- ReorderFunctions::readFunctionOrderFile())
+ ReorderFunctions::readFunctionOrderFile()) {
ReorderFunctionsUserSet.insert(Function);
+ if (std::optional<StringRef> LTOCommonName = getLTOCommonName(Function))
+ ReorderFunctionsLTOCommonSet.insert(*LTOCommonName);
+ }
}
uint64_t NumFunctionsToProcess = 0;
@@ -2795,6 +2799,10 @@
});
if (Match.has_value())
return true;
+ for (const StringRef Name : Function.getNames())
+ if (std::optional<StringRef> LTOCommonName = getLTOCommonName(Name))
+ if (ReorderFunctionsLTOCommonSet.contains(*LTOCommonName))
+ return true;
}
if (ProfileReader && !ProfileReader->mayHaveProfileData(Function))
Index: bolt/lib/Passes/ReorderFunctions.cpp
===================================================================
--- bolt/lib/Passes/ReorderFunctions.cpp
+++ bolt/lib/Passes/ReorderFunctions.cpp
@@ -333,6 +333,7 @@
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 @@
}
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,8 +369,10 @@
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())
@@ -377,6 +382,9 @@
<< ".\n";
}
}
+ if (InvalidEntries)
+ errs() << "BOLT-WARNING: ReorderFunctions: can't find functions for "
+ << InvalidEntries << " entries in -function-order list.\n";
}
break;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142397.491482.patch
Type: text/x-patch
Size: 2892 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230123/580c60b6/attachment.bin>
More information about the llvm-commits
mailing list