[PATCH] D125255: [llvm-profgen] Support a threshold to control hiding warning summaries
Lei Wang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 9 20:45:50 PDT 2022
wlei updated this revision to Diff 428282.
wlei added a comment.
Updating D125255 <https://reviews.llvm.org/D125255>: [llvm-profgen] Support a threshold to control hiding warning summaries
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D125255/new/
https://reviews.llvm.org/D125255
Files:
llvm/tools/llvm-profgen/ErrorHandling.h
llvm/tools/llvm-profgen/ProfiledBinary.cpp
llvm/tools/llvm-profgen/llvm-profgen.cpp
Index: llvm/tools/llvm-profgen/llvm-profgen.cpp
===================================================================
--- llvm/tools/llvm-profgen/llvm-profgen.cpp
+++ llvm/tools/llvm-profgen/llvm-profgen.cpp
@@ -71,6 +71,14 @@
"from it instead of the executable binary."),
cl::cat(ProfGenCategory));
+cl::opt<bool>
+ VerboseMode("verbose", cl::init(false), cl::ZeroOrMore,
+ cl::desc("Enable verbose mode, i.e. print out all warnings no "
+ "matter if it's below the threshold."));
+
+static cl::alias VA("v", cl::desc("Alias for --verbose"),
+ cl::aliasopt(VerboseMode));
+
extern cl::opt<bool> ShowDisassemblyOnly;
extern cl::opt<bool> ShowSourceLocations;
extern cl::opt<bool> SkipSymbolization;
Index: llvm/tools/llvm-profgen/ProfiledBinary.cpp
===================================================================
--- llvm/tools/llvm-profgen/ProfiledBinary.cpp
+++ llvm/tools/llvm-profgen/ProfiledBinary.cpp
@@ -188,7 +188,8 @@
}
emitWarningSummary(NoFuncEntryNum, BinaryFunctions.size(),
"of functions failed to determine function entry due to "
- "inconsistent name from symbol table and dwarf info.");
+ "inconsistent name from symbol table and dwarf info.",
+ true);
}
void ProfiledBinary::load() {
Index: llvm/tools/llvm-profgen/ErrorHandling.h
===================================================================
--- llvm/tools/llvm-profgen/ErrorHandling.h
+++ llvm/tools/llvm-profgen/ErrorHandling.h
@@ -10,6 +10,7 @@
#define LLVM_TOOLS_LLVM_PROFGEN_ERRORHANDLING_H
#include "llvm/ADT/Twine.h"
+#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorOr.h"
@@ -18,6 +19,8 @@
using namespace llvm;
+extern cl::opt<bool> VerboseMode;
+
[[noreturn]] inline void exitWithError(const Twine &Message,
StringRef Whence = StringRef(),
StringRef Hint = StringRef()) {
@@ -46,11 +49,12 @@
exitWithError(EO.takeError(), std::forward<Ts>(Args)...);
}
-inline void emitWarningSummary(uint64_t Num, uint64_t Total, StringRef Msg) {
- if (!Total || !Num)
- return;
- WithColor::warning() << format("%.2f", static_cast<double>(Num) * 100 / Total)
- << "%(" << Num << "/" << Total << ") " << Msg << "\n";
+inline void emitWarningSummary(uint64_t Num, uint64_t Total, StringRef Msg,
+ bool IsCritical = false) {
+ if (Total && Num && (VerboseMode || IsCritical))
+ WithColor::warning() << format("%.2f",
+ static_cast<double>(Num) * 100 / Total)
+ << "%(" << Num << "/" << Total << ") " << Msg << "\n";
}
#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125255.428282.patch
Type: text/x-patch
Size: 2873 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220510/9c053daf/attachment.bin>
More information about the llvm-commits
mailing list