[llvm] 0d36d84 - [llvm-reduce] Display all relevant options in -help
Markus Lavin via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 2 00:46:32 PST 2022
Author: Markus Lavin
Date: 2022-02-02T09:44:56+01:00
New Revision: 0d36d84de5f8182bd9c1628cb6cf4cd47d248c9e
URL: https://github.com/llvm/llvm-project/commit/0d36d84de5f8182bd9c1628cb6cf4cd47d248c9e
DIFF: https://github.com/llvm/llvm-project/commit/0d36d84de5f8182bd9c1628cb6cf4cd47d248c9e.diff
LOG: [llvm-reduce] Display all relevant options in -help
Previously the options category given to cl::HideUnrelatedOptions was
local to llvm-reduce.cpp and as a result only options declared in that
file were visible in the -help options listing. This was a bit
unfortunate since there were several useful options declared in other
files. This patch addresses that.
Differential Revision: https://reviews.llvm.org/D118682
Added:
Modified:
llvm/tools/llvm-reduce/DeltaManager.cpp
llvm/tools/llvm-reduce/deltas/Delta.cpp
llvm/tools/llvm-reduce/llvm-reduce.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-reduce/DeltaManager.cpp b/llvm/tools/llvm-reduce/DeltaManager.cpp
index 4d646a7c861d6..4abdf384aa00e 100644
--- a/llvm/tools/llvm-reduce/DeltaManager.cpp
+++ b/llvm/tools/llvm-reduce/DeltaManager.cpp
@@ -37,10 +37,12 @@
using namespace llvm;
+extern cl::OptionCategory LLVMReduceOptions;
static cl::opt<std::string>
DeltaPasses("delta-passes",
cl::desc("Delta passes to run, separated by commas. By "
- "default, run all delta passes."));
+ "default, run all delta passes."),
+ cl::cat(LLVMReduceOptions));
#define DELTA_PASSES \
DELTA_PASS("special-globals", reduceSpecialGlobalsDeltaPass) \
diff --git a/llvm/tools/llvm-reduce/deltas/Delta.cpp b/llvm/tools/llvm-reduce/deltas/Delta.cpp
index 1bab82f823c02..d48052742f938 100644
--- a/llvm/tools/llvm-reduce/deltas/Delta.cpp
+++ b/llvm/tools/llvm-reduce/deltas/Delta.cpp
@@ -26,25 +26,29 @@
using namespace llvm;
+extern cl::OptionCategory LLVMReduceOptions;
+
static cl::opt<bool> AbortOnInvalidReduction(
"abort-on-invalid-reduction",
- cl::desc("Abort if any reduction results in invalid IR"));
+ cl::desc("Abort if any reduction results in invalid IR"),
+ cl::cat(LLVMReduceOptions));
static cl::opt<unsigned int> StartingGranularityLevel(
"starting-granularity-level",
- cl::desc("Number of times to divide chunks prior to first test"));
+ cl::desc("Number of times to divide chunks prior to first test"),
+ cl::cat(LLVMReduceOptions));
static cl::opt<bool> TmpFilesAsBitcode(
"write-tmp-files-as-bitcode",
cl::desc("Write temporary files as bitcode, instead of textual IR"),
- cl::init(false));
+ cl::init(false), cl::cat(LLVMReduceOptions));
#ifdef LLVM_ENABLE_THREADS
static cl::opt<unsigned> NumJobs(
"j",
cl::desc("Maximum number of threads to use to process chunks. Set to 1 to "
"disables parallelism."),
- cl::init(1));
+ cl::init(1), cl::cat(LLVMReduceOptions));
#else
unsigned NumJobs = 1;
#endif
diff --git a/llvm/tools/llvm-reduce/llvm-reduce.cpp b/llvm/tools/llvm-reduce/llvm-reduce.cpp
index 59cc055a0870e..abcd4c6953869 100644
--- a/llvm/tools/llvm-reduce/llvm-reduce.cpp
+++ b/llvm/tools/llvm-reduce/llvm-reduce.cpp
@@ -36,44 +36,44 @@
using namespace llvm;
-static cl::OptionCategory Options("llvm-reduce options");
+cl::OptionCategory LLVMReduceOptions("llvm-reduce options");
static cl::opt<bool> Help("h", cl::desc("Alias for -help"), cl::Hidden,
- cl::cat(Options));
+ cl::cat(LLVMReduceOptions));
static cl::opt<bool> Version("v", cl::desc("Alias for -version"), cl::Hidden,
- cl::cat(Options));
+ cl::cat(LLVMReduceOptions));
static cl::opt<bool>
PrintDeltaPasses("print-delta-passes",
cl::desc("Print list of delta passes, passable to "
"--delta-passes as a comma separated list"),
- cl::cat(Options));
+ cl::cat(LLVMReduceOptions));
static cl::opt<std::string> InputFilename(cl::Positional, cl::Required,
cl::desc("<input llvm ll/bc file>"),
- cl::cat(Options));
+ cl::cat(LLVMReduceOptions));
static cl::opt<std::string>
TestFilename("test", cl::Required,
cl::desc("Name of the interesting-ness test to be run"),
- cl::cat(Options));
+ cl::cat(LLVMReduceOptions));
static cl::list<std::string>
TestArguments("test-arg", cl::ZeroOrMore,
cl::desc("Arguments passed onto the interesting-ness test"),
- cl::cat(Options));
+ cl::cat(LLVMReduceOptions));
static cl::opt<std::string> OutputFilename(
"output", cl::desc("Specify the output file. default: reduced.ll|mir"));
static cl::alias OutputFileAlias("o", cl::desc("Alias for -output"),
cl::aliasopt(OutputFilename),
- cl::cat(Options));
+ cl::cat(LLVMReduceOptions));
static cl::opt<bool>
ReplaceInput("in-place",
cl::desc("WARNING: This option will replace your input file "
"with the reduced version!"),
- cl::cat(Options));
+ cl::cat(LLVMReduceOptions));
enum class InputLanguages { None, IR, MIR };
@@ -83,17 +83,17 @@ static cl::opt<InputLanguages>
cl::init(InputLanguages::None),
cl::values(clEnumValN(InputLanguages::IR, "ir", ""),
clEnumValN(InputLanguages::MIR, "mir", "")),
- cl::cat(Options));
+ cl::cat(LLVMReduceOptions));
static cl::opt<std::string> TargetTriple("mtriple",
cl::desc("Set the target triple"),
- cl::cat(Options));
+ cl::cat(LLVMReduceOptions));
static cl::opt<int>
MaxPassIterations("max-pass-iterations",
cl::desc("Maximum number of times to run the full set "
"of delta passes (default=1)"),
- cl::init(1), cl::cat(Options));
+ cl::init(1), cl::cat(LLVMReduceOptions));
static codegen::RegisterCodeGenFlags CGF;
@@ -135,7 +135,7 @@ static std::unique_ptr<LLVMTargetMachine> createTargetMachine() {
int main(int Argc, char **Argv) {
InitLLVM X(Argc, Argv);
- cl::HideUnrelatedOptions({&Options, &getColorCategory()});
+ cl::HideUnrelatedOptions({&LLVMReduceOptions, &getColorCategory()});
cl::ParseCommandLineOptions(Argc, Argv, "LLVM automatic testcase reducer.\n");
bool ReduceModeMIR = false;
More information about the llvm-commits
mailing list