[llvm] [tools][llc] Add `--save-stats` option (PR #163967)
Jon Roelofs via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 27 16:03:00 PDT 2025
================
@@ -355,6 +366,50 @@ static std::unique_ptr<ToolOutputFile> GetOutputStream(const char *TargetName,
return FDOut;
}
+static int MaybeEnableStats() {
+ if (SaveStats.getNumOccurrences() > 0) {
+ if (SaveStats.empty() || SaveStats == "cwd" || SaveStats == "obj") {
+ llvm::EnableStatistics(false);
+ } else {
+ WithColor::error(errs(), "llc")
+ << "Invalid --save-stats value: " << SaveStats
+ << ", must be empty, 'cwd' or 'obj'\n";
----------------
jroelofs wrote:
I _think_ if you make the `cl::opt` one of the enum-flavored ones, you get this sort of error handling for free.
https://github.com/llvm/llvm-project/pull/163967
More information about the llvm-commits
mailing list