[clang] [llvm] [mlir] [polly] Remove unneeded cl::Optional from named options. NFC (PR #225870)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 23 10:53:23 PDT 2026
https://github.com/MaskRay created https://github.com/llvm/llvm-project/pull/225870
cl::Optional is the default for cl::opt and has been no-op since
https://reviews.llvm.org/D120455 removed the "may only occur zero or one
times!" error.
Extracted from #225628
>From 6b76a6e923b24ed2bda80f4b695c1822d92fa676 Mon Sep 17 00:00:00 2001
From: Fangrui Song <i at maskray.me>
Date: Wed, 23 Sep 2026 10:49:53 -0700
Subject: [PATCH] Remove unneeded cl::Optional from named options. NFC
cl::Optional is the default for cl::opt and has been no-op since
https://reviews.llvm.org/D120455 removed the "may only occur zero or one
times!" error.
Extracted from #225628
---
bolt/lib/Core/DynoStats.cpp | 1 -
bolt/lib/Passes/BinaryPasses.cpp | 3 +-
bolt/lib/Passes/Instrumentation.cpp | 22 ++---
bolt/lib/Passes/StokeInfo.cpp | 1 -
bolt/lib/Profile/DataAggregator.cpp | 3 +-
.../Target/AArch64/AArch64MCPlusBuilder.cpp | 2 +-
bolt/lib/Utils/CommandLineOpts.cpp | 13 ++-
bolt/tools/driver/llvm-bolt.cpp | 2 -
bolt/tools/merge-fdata/merge-fdata.cpp | 1 -
clang/lib/CodeGen/BackendUtil.cpp | 2 +-
clang/lib/CodeGen/CGExpr.cpp | 2 +-
clang/lib/Tooling/CommonOptionsParser.cpp | 2 +-
clang/tools/clang-diff/ClangDiff.cpp | 9 +-
.../clang-import-test/clang-import-test.cpp | 7 +-
.../ClangOffloadBundler.cpp | 2 +-
clang/tools/clang-refactor/ClangRefactor.cpp | 6 +-
.../LLJITDumpObjects/LLJITDumpObjects.cpp | 9 +-
.../SpeculativeJIT/SpeculativeJIT.cpp | 2 +-
llvm/lib/Analysis/IR2Vec.cpp | 10 +-
.../BasicBlockMatchingAndInference.cpp | 2 +-
llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp | 2 +-
llvm/lib/CodeGen/GlobalISel/Legalizer.cpp | 4 +-
llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp | 2 +-
llvm/lib/CodeGen/MIR2Vec.cpp | 17 ++--
llvm/lib/CodeGen/TargetPassConfig.cpp | 4 +-
llvm/lib/IR/OptBisect.cpp | 8 +-
llvm/lib/Support/DebugCounter.cpp | 3 -
.../Target/Hexagon/HexagonGlobalScheduler.cpp | 4 +-
llvm/lib/Target/Mips/MipsSubtarget.cpp | 2 +-
llvm/lib/Target/SPIRV/SPIRVAuxDataHandler.cpp | 2 +-
llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp | 2 +-
llvm/lib/Target/SPIRV/SPIRVSubtarget.cpp | 2 +-
llvm/lib/Target/SPIRV/SPIRVTargetMachine.cpp | 2 +-
.../Target/XCore/XCoreLowerThreadLocal.cpp | 6 +-
.../Instrumentation/AddressSanitizer.cpp | 3 +-
.../Instrumentation/HWAddressSanitizer.cpp | 6 +-
llvm/tools/llvm-cov/CodeCoverage.cpp | 95 +++++++++----------
llvm/tools/llvm-ir2vec/llvm-ir2vec.cpp | 2 +-
llvm/tools/llvm-jitlink/llvm-jitlink.cpp | 2 +-
llvm/tools/llvm-lto2/llvm-lto2.cpp | 3 +-
llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp | 22 ++---
llvm/tools/llvm-profgen/ProfileGenerator.cpp | 8 +-
llvm/tools/llvm-split/llvm-split.cpp | 2 +-
llvm/tools/llvm-undname/llvm-undname.cpp | 19 ++--
mlir/lib/Debug/DebugCounter.cpp | 2 +-
polly/lib/Analysis/ScopInfo.cpp | 7 +-
polly/lib/CodeGen/LoopGenerators.cpp | 5 +-
47 files changed, 155 insertions(+), 182 deletions(-)
diff --git a/bolt/lib/Core/DynoStats.cpp b/bolt/lib/Core/DynoStats.cpp
index 64a6d12b76e821..4a8f4e72271246 100644
--- a/bolt/lib/Core/DynoStats.cpp
+++ b/bolt/lib/Core/DynoStats.cpp
@@ -33,7 +33,6 @@ extern cl::OptionCategory BoltCategory;
static cl::opt<uint32_t>
DynoStatsScale("dyno-stats-scale",
cl::desc("scale to be applied while reporting dyno stats"),
- cl::Optional,
cl::init(1),
cl::Hidden,
cl::cat(BoltCategory));
diff --git a/bolt/lib/Passes/BinaryPasses.cpp b/bolt/lib/Passes/BinaryPasses.cpp
index 4bb3f0988de6b8..16b1752c1db866 100644
--- a/bolt/lib/Passes/BinaryPasses.cpp
+++ b/bolt/lib/Passes/BinaryPasses.cpp
@@ -243,8 +243,7 @@ static cl::opt<int> ProfileDensityCutOffHot(
static cl::opt<double> ProfileDensityThreshold(
"profile-density-threshold", cl::init(60),
cl::desc("If the profile density is below the given threshold, it "
- "will be suggested to increase the sampling rate."),
- cl::Optional);
+ "will be suggested to increase the sampling rate."));
} // namespace opts
diff --git a/bolt/lib/Passes/Instrumentation.cpp b/bolt/lib/Passes/Instrumentation.cpp
index ffcfb264159719..581d720d07db58 100644
--- a/bolt/lib/Passes/Instrumentation.cpp
+++ b/bolt/lib/Passes/Instrumentation.cpp
@@ -31,30 +31,30 @@ cl::opt<std::string> InstrumentationFilename(
"instrumentation-file",
cl::desc("file name where instrumented profile will be saved (default: "
"/tmp/prof.fdata)"),
- cl::init("/tmp/prof.fdata"), cl::Optional, cl::cat(BoltInstrCategory));
+ cl::init("/tmp/prof.fdata"), cl::cat(BoltInstrCategory));
cl::opt<std::string> InstrumentationBinpath(
"instrumentation-binpath",
cl::desc("path to instrumented binary in case if /proc/self/map_files "
"is not accessible due to access restriction issues"),
- cl::Optional, cl::cat(BoltInstrCategory));
+ cl::cat(BoltInstrCategory));
cl::opt<bool> InstrumentationFileAppendPID(
"instrumentation-file-append-pid",
cl::desc("append PID to saved profile file name (default: false)"),
- cl::init(false), cl::Optional, cl::cat(BoltInstrCategory));
+ cl::init(false), cl::cat(BoltInstrCategory));
cl::opt<bool> ConservativeInstrumentation(
"conservative-instrumentation",
cl::desc("disable instrumentation optimizations that sacrifice profile "
"accuracy (for debugging, default: false)"),
- cl::init(false), cl::Optional, cl::cat(BoltInstrCategory));
+ cl::init(false), cl::cat(BoltInstrCategory));
cl::opt<uint32_t> InstrumentationMaxSize(
"instrumentation-max-size",
cl::desc("Set max memory size of the instrumentation bump allocator "
"default: 0x6400000)"),
- cl::init(0x6400000), cl::Optional, cl::cat(BoltInstrCategory));
+ cl::init(0x6400000), cl::cat(BoltInstrCategory));
cl::opt<uint32_t> InstrumentationSleepTime(
"instrumentation-sleep-time",
@@ -62,32 +62,30 @@ cl::opt<uint32_t> InstrumentationSleepTime(
"program end). This is useful for service workloads when you "
"want to dump profile every X minutes or if you are killing the "
"program and the profile is not being dumped at the end."),
- cl::init(0), cl::Optional, cl::cat(BoltInstrCategory));
+ cl::init(0), cl::cat(BoltInstrCategory));
cl::opt<bool> InstrumentationNoCountersClear(
"instrumentation-no-counters-clear",
cl::desc("Don't clear counters across dumps "
"(use with instrumentation-sleep-time option)"),
- cl::init(false), cl::Optional, cl::cat(BoltInstrCategory));
+ cl::init(false), cl::cat(BoltInstrCategory));
cl::opt<bool> InstrumentationWaitForks(
"instrumentation-wait-forks",
cl::desc("Wait until all forks of instrumented process will finish "
"(use with instrumentation-sleep-time option)"),
- cl::init(false), cl::Optional, cl::cat(BoltInstrCategory));
+ cl::init(false), cl::cat(BoltInstrCategory));
cl::opt<bool>
InstrumentHotOnly("instrument-hot-only",
cl::desc("only insert instrumentation on hot functions "
"(needs profile, default: false)"),
- cl::init(false), cl::Optional,
- cl::cat(BoltInstrCategory));
+ cl::init(false), cl::cat(BoltInstrCategory));
cl::opt<bool> InstrumentCalls("instrument-calls",
cl::desc("record profile for inter-function "
"control flow activity (default: true)"),
- cl::init(true), cl::Optional,
- cl::cat(BoltInstrCategory));
+ cl::init(true), cl::cat(BoltInstrCategory));
} // namespace opts
namespace llvm {
diff --git a/bolt/lib/Passes/StokeInfo.cpp b/bolt/lib/Passes/StokeInfo.cpp
index 05cdf63a4af18a..c3afe21775cb7b 100644
--- a/bolt/lib/Passes/StokeInfo.cpp
+++ b/bolt/lib/Passes/StokeInfo.cpp
@@ -26,7 +26,6 @@ static cl::OptionCategory StokeOptCategory("STOKE pass options");
static cl::opt<std::string>
StokeOutputDataFilename("stoke-out",
cl::desc("output data (.csv) for Stoke's use"),
- cl::Optional,
cl::cat(StokeOptCategory));
}
diff --git a/bolt/lib/Profile/DataAggregator.cpp b/bolt/lib/Profile/DataAggregator.cpp
index 9f4d988ed0c0e0..94952e23ad05ee 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -93,7 +93,7 @@ static cl::list<unsigned long long>
static cl::opt<bool> ImputeTraceFallthrough(
"impute-trace-fall-through",
cl::desc("impute missing fall-throughs for branch-only traces"),
- cl::Optional, cl::cat(AggregatorCategory));
+ cl::cat(AggregatorCategory));
static cl::opt<bool>
IgnoreBuildID("ignore-build-id",
@@ -110,7 +110,6 @@ static cl::opt<unsigned long long>
MaxSamples("max-samples",
cl::init(-1ULL),
cl::desc("maximum number of samples to read from LBR profile"),
- cl::Optional,
cl::Hidden,
cl::cat(AggregatorCategory));
diff --git a/bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp b/bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp
index 2a39aa63554d93..bd4fcd308c2545 100644
--- a/bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp
+++ b/bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp
@@ -45,7 +45,7 @@ static cl::opt<bool> NoLSEAtomics(
"no-lse-atomics",
cl::desc("generate instrumentation code sequence without using LSE atomic "
"instruction"),
- cl::init(false), cl::Optional, cl::cat(BoltInstrCategory));
+ cl::init(false), cl::cat(BoltInstrCategory));
} // namespace opts
namespace {
diff --git a/bolt/lib/Utils/CommandLineOpts.cpp b/bolt/lib/Utils/CommandLineOpts.cpp
index 74ca935ee471e3..52ed4289927aa9 100644
--- a/bolt/lib/Utils/CommandLineOpts.cpp
+++ b/bolt/lib/Utils/CommandLineOpts.cpp
@@ -102,7 +102,7 @@ AggregateOnly("aggregate-only",
cl::opt<unsigned>
BucketsPerLine("line-size",
cl::desc("number of entries per line (default 256)"),
- cl::init(256), cl::Optional, cl::cat(HeatmapCategory));
+ cl::init(256), cl::cat(HeatmapCategory));
cl::opt<bool>
CompactCodeModel("compact-code-model",
@@ -238,22 +238,22 @@ cl::opt<int> HeatmapCdfPct(
cl::opt<unsigned long long> HeatmapMaxAddress(
"max-address", cl::init(0xffffffff),
cl::desc("maximum address considered valid for heatmap (default 4GB)"),
- cl::Optional, cl::cat(HeatmapCategory));
+ cl::cat(HeatmapCategory));
cl::opt<unsigned long long> HeatmapMinAddress(
"min-address", cl::init(0x0),
cl::desc("minimum address considered valid for heatmap (default 0)"),
- cl::Optional, cl::cat(HeatmapCategory));
+ cl::cat(HeatmapCategory));
cl::opt<bool> HeatmapPrintMappings(
"print-mappings", cl::init(false),
cl::desc("print mappings in the legend, between characters/blocks and text "
"sections (default false)"),
- cl::Optional, cl::cat(HeatmapCategory));
+ cl::cat(HeatmapCategory));
cl::opt<std::string> HeatmapOutput("heatmap",
cl::desc("print heatmap to a given file"),
- cl::Optional, cl::cat(HeatmapCategory));
+ cl::cat(HeatmapCategory));
cl::opt<bool> HotData("hot-data",
cl::desc("hot data symbols support (relocation mode)"),
@@ -297,7 +297,6 @@ cl::opt<bool> Lite("lite", cl::desc("skip processing of cold functions"),
cl::opt<std::string>
OutputFilename("o",
cl::desc("<output file>"),
- cl::Optional,
cl::cat(BoltOutputCategory));
cl::list<std::string> PerfData("perfdata", cl::CommaSeparated,
@@ -350,7 +349,7 @@ cl::opt<std::string> SaveProfile("w",
cl::opt<bool> ShowDensity("show-density",
cl::desc("show profile density details"),
- cl::Optional, cl::cat(AggregatorCategory));
+ cl::cat(AggregatorCategory));
cl::opt<bool> SplitEH("split-eh", cl::desc("split C++ exception handling code"),
cl::Hidden, cl::cat(BoltOptCategory));
diff --git a/bolt/tools/driver/llvm-bolt.cpp b/bolt/tools/driver/llvm-bolt.cpp
index cc8e6d70001ebf..11a31e9e42a02e 100644
--- a/bolt/tools/driver/llvm-bolt.cpp
+++ b/bolt/tools/driver/llvm-bolt.cpp
@@ -54,7 +54,6 @@ static cl::opt<std::string> InputFilename(cl::Positional,
static cl::opt<std::string>
InputDataFilename("data",
cl::desc("<data file>"),
- cl::Optional,
cl::cat(BoltCategory));
static cl::alias
@@ -71,7 +70,6 @@ static cl::opt<std::string>
static cl::opt<std::string>
InputDataFilename2("data2",
cl::desc("<data file>"),
- cl::Optional,
cl::cat(BoltCategory));
static cl::opt<std::string>
diff --git a/bolt/tools/merge-fdata/merge-fdata.cpp b/bolt/tools/merge-fdata/merge-fdata.cpp
index 79f0b574f639a2..d7cd725665a826 100644
--- a/bolt/tools/merge-fdata/merge-fdata.cpp
+++ b/bolt/tools/merge-fdata/merge-fdata.cpp
@@ -67,7 +67,6 @@ static cl::opt<bool>
SuppressMergedDataOutput("q",
cl::desc("do not print merged data to stdout"),
cl::init(false),
- cl::Optional,
cl::cat(MergeFdataCategory));
static cl::opt<std::string>
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index 8103b72cf4e3a2..5a01779613c8c0 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -111,7 +111,7 @@ using namespace llvm;
namespace llvm {
// Experiment to move sanitizers earlier.
static cl::opt<bool> ClSanitizeOnOptimizerEarlyEP(
- "sanitizer-early-opt-ep", cl::Optional,
+ "sanitizer-early-opt-ep",
cl::desc("Insert sanitizers on OptimizerEarlyEP."));
// Experiment to mark cold functions as optsize/minsize/optnone.
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index aca0415d7f5449..4a481c01f6a68b 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -69,7 +69,7 @@ namespace clang {
// TODO: consider deprecating ClSanitizeGuardChecks; functionality is subsumed
// by -fsanitize-skip-hot-cutoff
llvm::cl::opt<bool> ClSanitizeGuardChecks(
- "ubsan-guard-checks", llvm::cl::Optional,
+ "ubsan-guard-checks",
llvm::cl::desc("Guard UBSAN checks with `llvm.allow.ubsan.check()`."));
} // namespace clang
diff --git a/clang/lib/Tooling/CommonOptionsParser.cpp b/clang/lib/Tooling/CommonOptionsParser.cpp
index 454e7ca68a65f4..14d27b32686006 100644
--- a/clang/lib/Tooling/CommonOptionsParser.cpp
+++ b/clang/lib/Tooling/CommonOptionsParser.cpp
@@ -85,7 +85,7 @@ llvm::Error CommonOptionsParser::init(
llvm::cl::NumOccurrencesFlag OccurrencesFlag, const char *Overview) {
static cl::opt<std::string> BuildPath("p", cl::desc("Build path"),
- cl::Optional, cl::cat(Category),
+ cl::cat(Category),
cl::sub(cl::SubCommand::getAll()));
static cl::list<std::string> SourcePaths(
diff --git a/clang/tools/clang-diff/ClangDiff.cpp b/clang/tools/clang-diff/ClangDiff.cpp
index 3046e9c5fa371d..1e1e8fdbb05031 100644
--- a/clang/tools/clang-diff/ClangDiff.cpp
+++ b/clang/tools/clang-diff/ClangDiff.cpp
@@ -51,14 +51,13 @@ static cl::opt<std::string> DestinationPath(cl::Positional,
static cl::opt<std::string> StopAfter("stop-diff-after",
cl::desc("<topdown|bottomup>"),
- cl::Optional, cl::init(""),
- cl::cat(ClangDiffCategory));
+ cl::init(""), cl::cat(ClangDiffCategory));
-static cl::opt<int> MaxSize("s", cl::desc("<maxsize>"), cl::Optional,
- cl::init(-1), cl::cat(ClangDiffCategory));
+static cl::opt<int> MaxSize("s", cl::desc("<maxsize>"), cl::init(-1),
+ cl::cat(ClangDiffCategory));
static cl::opt<std::string> BuildPath("p", cl::desc("Build path"), cl::init(""),
- cl::Optional, cl::cat(ClangDiffCategory));
+ cl::cat(ClangDiffCategory));
static cl::list<std::string> ArgsAfter(
"extra-arg",
diff --git a/clang/tools/clang-import-test/clang-import-test.cpp b/clang/tools/clang-import-test/clang-import-test.cpp
index bcb5d2bdb89521..d555ecffee9fb0 100644
--- a/clang/tools/clang-import-test/clang-import-test.cpp
+++ b/clang/tools/clang-import-test/clang-import-test.cpp
@@ -48,11 +48,11 @@ static llvm::cl::list<std::string>
llvm::cl::desc("Path to a file containing declarations to import"));
static llvm::cl::opt<bool>
- Direct("direct", llvm::cl::Optional,
+ Direct("direct",
llvm::cl::desc("Use the parsed declarations without indirection"));
static llvm::cl::opt<bool> UseOrigins(
- "use-origins", llvm::cl::Optional,
+ "use-origins",
llvm::cl::desc(
"Use DeclContext origin information for more accurate lookups"));
@@ -62,8 +62,7 @@ static llvm::cl::list<std::string>
llvm::cl::CommaSeparated);
static llvm::cl::opt<std::string>
- Input("x", llvm::cl::Optional,
- llvm::cl::desc("The language to parse (default: c++)"),
+ Input("x", llvm::cl::desc("The language to parse (default: c++)"),
llvm::cl::init("c++"));
static llvm::cl::opt<bool> ObjCARC("objc-arc", llvm::cl::init(false),
diff --git a/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp b/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
index aa89d7561b3f89..68ebf320148b13 100644
--- a/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
+++ b/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
@@ -145,7 +145,7 @@ int main(int argc, const char **argv) {
cl::init(false), cl::cat(ClangOffloadBundlerCategory));
cl::opt<int> CompressionLevel(
"compression-level", cl::desc("Specify the compression level (integer)"),
- cl::value_desc("n"), cl::Optional, cl::cat(ClangOffloadBundlerCategory));
+ cl::value_desc("n"), cl::cat(ClangOffloadBundlerCategory));
// Process commandline options and report errors
sys::PrintStackTraceOnErrorSignal(argv[0]);
diff --git a/clang/tools/clang-refactor/ClangRefactor.cpp b/clang/tools/clang-refactor/ClangRefactor.cpp
index d011bf30a7c5c3..125ee74f8e382d 100644
--- a/clang/tools/clang-refactor/ClangRefactor.cpp
+++ b/clang/tools/clang-refactor/ClangRefactor.cpp
@@ -240,9 +240,9 @@ class CommandLineRefactoringOptionCreator final
"specified for one refactoring action");
// FIXME: cl::Required can be specified when this option is present
// in all rules in an action.
- return std::make_unique<cl::opt<T>>(
- Opt.getName(), cl::desc(Opt.getDescription()), cl::Optional,
- cl::cat(Category), cl::sub(Subcommand));
+ return std::make_unique<cl::opt<T>>(Opt.getName(),
+ cl::desc(Opt.getDescription()),
+ cl::cat(Category), cl::sub(Subcommand));
}
llvm::SmallPtrSet<const RefactoringOption *, 8> Visited;
diff --git a/llvm/examples/OrcV2Examples/LLJITDumpObjects/LLJITDumpObjects.cpp b/llvm/examples/OrcV2Examples/LLJITDumpObjects/LLJITDumpObjects.cpp
index 264656a838ae8d..bd32212d3204f5 100644
--- a/llvm/examples/OrcV2Examples/LLJITDumpObjects/LLJITDumpObjects.cpp
+++ b/llvm/examples/OrcV2Examples/LLJITDumpObjects/LLJITDumpObjects.cpp
@@ -23,15 +23,14 @@ ExitOnError ExitOnErr;
static cl::opt<bool> DumpJITdObjects("dump-jitted-objects",
cl::desc("dump jitted objects"),
- cl::Optional, cl::init(true));
+ cl::init(true));
-static cl::opt<std::string> DumpDir("dump-dir",
- cl::desc("directory to dump objects to"),
- cl::Optional, cl::init(""));
+static cl::opt<std::string>
+ DumpDir("dump-dir", cl::desc("directory to dump objects to"), cl::init(""));
static cl::opt<std::string>
DumpFileStem("dump-file-stem", cl::desc("Override default dump names"),
- cl::Optional, cl::init(""));
+ cl::init(""));
int main(int argc, char *argv[]) {
// Initialize LLVM.
diff --git a/llvm/examples/SpeculativeJIT/SpeculativeJIT.cpp b/llvm/examples/SpeculativeJIT/SpeculativeJIT.cpp
index 1b88b23abdc1f0..cc536549cdd890 100644
--- a/llvm/examples/SpeculativeJIT/SpeculativeJIT.cpp
+++ b/llvm/examples/SpeculativeJIT/SpeculativeJIT.cpp
@@ -32,7 +32,7 @@ static cl::list<std::string> InputArgv("args", cl::Positional,
cl::desc("<program arguments>..."),
cl::PositionalEatsArgs);
-static cl::opt<unsigned> NumThreads("num-threads", cl::Optional,
+static cl::opt<unsigned> NumThreads("num-threads",
cl::desc("Number of compile threads"),
cl::init(4));
diff --git a/llvm/lib/Analysis/IR2Vec.cpp b/llvm/lib/Analysis/IR2Vec.cpp
index 059a7a5cb0dd6e..1c11fbe0f849f8 100644
--- a/llvm/lib/Analysis/IR2Vec.cpp
+++ b/llvm/lib/Analysis/IR2Vec.cpp
@@ -40,20 +40,20 @@ cl::OptionCategory IR2VecCategory("IR2Vec Options");
// FIXME: Use a default vocab when not specified
cl::opt<std::string>
- VocabFile("ir2vec-vocab-path", cl::Optional,
+ VocabFile("ir2vec-vocab-path",
cl::desc("Path to the vocabulary file for IR2Vec"), cl::init(""),
cl::cat(IR2VecCategory));
-cl::opt<float> OpcWeight("ir2vec-opc-weight", cl::Optional, cl::init(1.0),
+cl::opt<float> OpcWeight("ir2vec-opc-weight", cl::init(1.0),
cl::desc("Weight for opcode embeddings"),
cl::cat(IR2VecCategory));
-cl::opt<float> TypeWeight("ir2vec-type-weight", cl::Optional, cl::init(0.5),
+cl::opt<float> TypeWeight("ir2vec-type-weight", cl::init(0.5),
cl::desc("Weight for type embeddings"),
cl::cat(IR2VecCategory));
-cl::opt<float> ArgWeight("ir2vec-arg-weight", cl::Optional, cl::init(0.2),
+cl::opt<float> ArgWeight("ir2vec-arg-weight", cl::init(0.2),
cl::desc("Weight for argument embeddings"),
cl::cat(IR2VecCategory));
cl::opt<IR2VecKind> IR2VecEmbeddingKind(
- "ir2vec-kind", cl::Optional,
+ "ir2vec-kind",
cl::values(clEnumValN(IR2VecKind::Symbolic, "symbolic",
"Generate symbolic embeddings"),
clEnumValN(IR2VecKind::FlowAware, "flow-aware",
diff --git a/llvm/lib/CodeGen/BasicBlockMatchingAndInference.cpp b/llvm/lib/CodeGen/BasicBlockMatchingAndInference.cpp
index d956bd475c9e64..439bf14e30ee55 100644
--- a/llvm/lib/CodeGen/BasicBlockMatchingAndInference.cpp
+++ b/llvm/lib/CodeGen/BasicBlockMatchingAndInference.cpp
@@ -31,7 +31,7 @@ using namespace llvm;
static cl::opt<float>
PropellerInferThreshold("propeller-infer-threshold",
cl::desc("Threshold for infer stale profile"),
- cl::init(0.6), cl::Optional);
+ cl::init(0.6));
/// The object is used to identify and match basic blocks given their hashes.
class StaleMatcher {
diff --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
index 6d1fcdb18834a9..5ec38e5b7f6a46 100644
--- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
@@ -104,7 +104,7 @@ using namespace llvm;
static cl::opt<bool>
EnableCSEInIRTranslator("enable-cse-in-irtranslator",
cl::desc("Should enable CSE in irtranslator"),
- cl::Optional, cl::init(false));
+ cl::init(false));
namespace llvm {
diff --git a/llvm/lib/CodeGen/GlobalISel/Legalizer.cpp b/llvm/lib/CodeGen/GlobalISel/Legalizer.cpp
index 8b608cd75cb127..79bd6899115c2c 100644
--- a/llvm/lib/CodeGen/GlobalISel/Legalizer.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/Legalizer.cpp
@@ -41,14 +41,14 @@ using namespace llvm;
static cl::opt<bool>
EnableCSEInLegalizer("enable-cse-in-legalizer",
cl::desc("Should enable CSE in Legalizer"),
- cl::Optional, cl::init(false));
+ cl::init(false));
// This is a temporary hack, should be removed soon.
static cl::opt<bool> AllowGInsertAsArtifact(
"allow-ginsert-as-artifact",
cl::desc("Allow G_INSERT to be considered an artifact. Hack around AMDGPU "
"test infinite loops."),
- cl::Optional, cl::init(true));
+ cl::init(true));
enum class DebugLocVerifyLevel {
None,
diff --git a/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp b/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp
index b447b3a30249c8..261193cd790abc 100644
--- a/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp
@@ -63,7 +63,7 @@ static constexpr unsigned ImpossibleRepairCost =
std::numeric_limits<unsigned>::max();
static cl::opt<RegBankSelectMode> RegBankSelectModeOption(
- cl::desc("Mode of the RegBankSelect pass"), cl::Hidden, cl::Optional,
+ cl::desc("Mode of the RegBankSelect pass"), cl::Hidden,
cl::values(clEnumValN(RegBankSelectMode::Fast, "regbankselect-fast",
"Run the Fast mode (default mapping)"),
clEnumValN(RegBankSelectMode::Greedy, "regbankselect-greedy",
diff --git a/llvm/lib/CodeGen/MIR2Vec.cpp b/llvm/lib/CodeGen/MIR2Vec.cpp
index 41ad87d2252592..30f30ec57020d7 100644
--- a/llvm/lib/CodeGen/MIR2Vec.cpp
+++ b/llvm/lib/CodeGen/MIR2Vec.cpp
@@ -38,28 +38,29 @@ cl::OptionCategory MIR2VecCategory("MIR2Vec Options");
// FIXME: Use a default vocab when not specified
static cl::opt<std::string>
- VocabFile("mir2vec-vocab-path", cl::Optional,
+ VocabFile("mir2vec-vocab-path",
cl::desc("Path to the vocabulary file for MIR2Vec"), cl::init(""),
cl::cat(MIR2VecCategory));
-cl::opt<float> OpcWeight("mir2vec-opc-weight", cl::Optional, cl::init(1.0),
+cl::opt<float> OpcWeight("mir2vec-opc-weight", cl::init(1.0),
cl::desc("Weight for machine opcode embeddings"),
cl::cat(MIR2VecCategory));
-cl::opt<float> CommonOperandWeight(
- "mir2vec-common-operand-weight", cl::Optional, cl::init(1.0),
- cl::desc("Weight for common operand embeddings"), cl::cat(MIR2VecCategory));
cl::opt<float>
- RegOperandWeight("mir2vec-reg-operand-weight", cl::Optional, cl::init(1.0),
+ CommonOperandWeight("mir2vec-common-operand-weight", cl::init(1.0),
+ cl::desc("Weight for common operand embeddings"),
+ cl::cat(MIR2VecCategory));
+cl::opt<float>
+ RegOperandWeight("mir2vec-reg-operand-weight", cl::init(1.0),
cl::desc("Weight for register operand embeddings"),
cl::cat(MIR2VecCategory));
cl::opt<MIR2VecKind> MIR2VecEmbeddingKind(
- "mir2vec-kind", cl::Optional,
+ "mir2vec-kind",
cl::values(clEnumValN(MIR2VecKind::Symbolic, "symbolic",
"Generate symbolic embeddings for MIR")),
cl::init(MIR2VecKind::Symbolic), cl::desc("MIR2Vec embedding kind"),
cl::cat(MIR2VecCategory));
static cl::opt<bool> PrintAllVocabEntries(
- "mir2vec-print-all-vocab-entries", cl::Optional, cl::init(false),
+ "mir2vec-print-all-vocab-entries", cl::init(false),
cl::desc("Print all vocabulary entries including zero embeddings"),
cl::cat(MIR2VecCategory));
diff --git a/llvm/lib/CodeGen/TargetPassConfig.cpp b/llvm/lib/CodeGen/TargetPassConfig.cpp
index 9e73048264b0a8..ca67084100254f 100644
--- a/llvm/lib/CodeGen/TargetPassConfig.cpp
+++ b/llvm/lib/CodeGen/TargetPassConfig.cpp
@@ -294,13 +294,13 @@ static cl::opt<bool> BasicBlockSectionMatchInfer(
"basic-block-section-match-infer",
cl::desc(
"Enable matching and inference when generating basic block sections"),
- cl::init(false), cl::Optional);
+ cl::init(false));
cl::opt<bool> EmitBBHash(
"emit-bb-hash",
cl::desc(
"Emit the hash of basic block in the SHT_LLVM_BB_ADDR_MAP section."),
- cl::init(false), cl::Optional);
+ cl::init(false));
/// Allow standard passes to be disabled by command line options. This supports
/// simple binary flags that either suppress the pass or do nothing.
diff --git a/llvm/lib/IR/OptBisect.cpp b/llvm/lib/IR/OptBisect.cpp
index 39562664e609ca..7105e67d37a33a 100644
--- a/llvm/lib/IR/OptBisect.cpp
+++ b/llvm/lib/IR/OptBisect.cpp
@@ -29,7 +29,7 @@ static OptBisect &getOptBisector() {
}
static cl::opt<int> OptBisectLimit(
- "opt-bisect-limit", cl::Hidden, cl::init(-1), cl::Optional,
+ "opt-bisect-limit", cl::Hidden, cl::init(-1),
cl::cb<void, int>([](int Limit) {
if (Limit == -1)
// -1 means run all passes.
@@ -49,7 +49,7 @@ static cl::opt<int> OptBisectLimit(
"Maximum optimization to perform (equivalent to -opt-bisect=1-N)"));
static cl::opt<std::string> OptBisectIntervals(
- "opt-bisect", cl::Hidden, cl::Optional,
+ "opt-bisect", cl::Hidden,
cl::cb<void, const std::string &>([](const std::string &IntervalStr) {
if (IntervalStr == "-1") {
// -1 means run all passes.
@@ -77,10 +77,10 @@ static cl::opt<bool> OptBisectVerbose(
"opt-bisect-verbose",
cl::desc(
"Show verbose output when opt-bisect-limit and/or opt-disable are set"),
- cl::Hidden, cl::init(true), cl::Optional);
+ cl::Hidden, cl::init(true));
static cl::list<std::string> OptDisablePasses(
- "opt-disable", cl::Hidden, cl::CommaSeparated, cl::Optional,
+ "opt-disable", cl::Hidden, cl::CommaSeparated,
cl::cb<void, std::string>([](const std::string &Pass) {
getOptBisector().setDisabled(Pass);
}),
diff --git a/llvm/lib/Support/DebugCounter.cpp b/llvm/lib/Support/DebugCounter.cpp
index ae388474a7925a..d9786838aba23b 100644
--- a/llvm/lib/Support/DebugCounter.cpp
+++ b/llvm/lib/Support/DebugCounter.cpp
@@ -64,7 +64,6 @@ struct DebugCounterOwner : DebugCounter {
cl::opt<bool, true> PrintDebugCounter{
"print-debug-counter",
cl::Hidden,
- cl::Optional,
cl::location(this->ShouldPrintCounter),
cl::init(false),
cl::desc("Print out debug counter info after all counters accumulated"),
@@ -75,14 +74,12 @@ struct DebugCounterOwner : DebugCounter {
cl::opt<bool, true> PrintDebugCounterQueries{
"print-debug-counter-queries",
cl::Hidden,
- cl::Optional,
cl::location(this->ShouldPrintCounterQueries),
cl::init(false),
cl::desc("Print out each query of an enabled debug counter")};
cl::opt<bool, true> BreakOnLastCount{
"debug-counter-break-on-last",
cl::Hidden,
- cl::Optional,
cl::location(this->BreakOnLast),
cl::init(false),
cl::desc("Insert a break point on the last enabled count of a "
diff --git a/llvm/lib/Target/Hexagon/HexagonGlobalScheduler.cpp b/llvm/lib/Target/Hexagon/HexagonGlobalScheduler.cpp
index 73ffb42914ad2e..37c51da2db1707 100644
--- a/llvm/lib/Target/Hexagon/HexagonGlobalScheduler.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonGlobalScheduler.cpp
@@ -107,11 +107,11 @@ static cl::opt<unsigned> SecondaryCandidateQueueSize("pull-up-sec-queue-size",
cl::Hidden, cl::init(2));
static cl::opt<bool> PostPullUpOpt(
- "post-pull-up-opt", cl::Hidden, cl::Optional, cl::init(true),
+ "post-pull-up-opt", cl::Hidden, cl::init(true),
cl::desc("Enable opt. exposed by pull-up e.g., remove redundant jumps"));
static cl::opt<bool> SpeculateNonPredInsn(
- "speculate-non-pred-insn", cl::Hidden, cl::Optional, cl::init(true),
+ "speculate-non-pred-insn", cl::Hidden, cl::init(true),
cl::desc("Speculate non-predicable instructions in parent BB"));
static cl::opt<bool>
diff --git a/llvm/lib/Target/Mips/MipsSubtarget.cpp b/llvm/lib/Target/Mips/MipsSubtarget.cpp
index 3726a8e04166c9..1a578fd63ffe4c 100644
--- a/llvm/lib/Target/Mips/MipsSubtarget.cpp
+++ b/llvm/lib/Target/Mips/MipsSubtarget.cpp
@@ -28,7 +28,7 @@
using namespace llvm;
cl::opt<CompactBranchPolicy> MipsCompactBranchPolicy(
- "mips-compact-branches", cl::Optional, cl::init(CB_Optimal),
+ "mips-compact-branches", cl::init(CB_Optimal),
cl::desc("MIPS Specific: Compact branch policy."),
cl::values(clEnumValN(CB_Never, "never",
"Do not use compact branches if possible."),
diff --git a/llvm/lib/Target/SPIRV/SPIRVAuxDataHandler.cpp b/llvm/lib/Target/SPIRV/SPIRVAuxDataHandler.cpp
index 469c261ac433e7..e01a5c49bfa673 100644
--- a/llvm/lib/Target/SPIRV/SPIRVAuxDataHandler.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVAuxDataHandler.cpp
@@ -32,7 +32,7 @@ static cl::opt<bool> SPVPreserveAuxData(
cl::desc("Preserve LLVM attributes and metadata as "
"NonSemantic.AuxData ExtInst annotations (requires "
"SPV_KHR_non_semantic_info)"),
- cl::Optional, cl::Hidden, cl::init(false));
+ cl::Hidden, cl::init(false));
namespace {
enum AuxDataLinkageType : uint32_t {
diff --git a/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp b/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp
index 39918b6610fce1..5eb0118ca8cfa3 100644
--- a/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp
@@ -36,7 +36,7 @@ using namespace llvm;
static cl::opt<bool>
SPVDumpDeps("spv-dump-deps",
cl::desc("Dump MIR with SPIR-V dependencies info"),
- cl::Optional, cl::init(false));
+ cl::init(false));
static cl::list<SPIRV::Capability::Capability>
AvoidCapabilities("avoid-spirv-capabilities",
diff --git a/llvm/lib/Target/SPIRV/SPIRVSubtarget.cpp b/llvm/lib/Target/SPIRV/SPIRVSubtarget.cpp
index 1f500828908982..a377c260a5fa14 100644
--- a/llvm/lib/Target/SPIRV/SPIRVSubtarget.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVSubtarget.cpp
@@ -33,7 +33,7 @@ using namespace llvm;
static cl::opt<bool>
SPVTranslatorCompat("translator-compatibility-mode",
cl::desc("SPIR-V Translator compatibility mode"),
- cl::Optional, cl::init(false));
+ cl::init(false));
static cl::opt<ExtensionSet, false, SPIRVExtensionsParser>
Extensions("spirv-ext",
diff --git a/llvm/lib/Target/SPIRV/SPIRVTargetMachine.cpp b/llvm/lib/Target/SPIRV/SPIRVTargetMachine.cpp
index b1f70442b26afb..7df3f9881fe730 100644
--- a/llvm/lib/Target/SPIRV/SPIRVTargetMachine.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVTargetMachine.cpp
@@ -266,7 +266,7 @@ static cl::opt<bool> SPVEnableNonSemanticDI(
"spv-emit-nonsemantic-debug-info",
cl::desc("Deprecated. Use -g to emit SPIR-V NonSemantic.Shader.DebugInfo "
"instructions"),
- cl::Optional, cl::init(false));
+ cl::init(false));
// Add the custom SPIRVInstructionSelect from above.
bool SPIRVPassConfig::addGlobalInstructionSelect() {
diff --git a/llvm/lib/Target/XCore/XCoreLowerThreadLocal.cpp b/llvm/lib/Target/XCore/XCoreLowerThreadLocal.cpp
index f32a155c85928c..e511dc040d90fe 100644
--- a/llvm/lib/Target/XCore/XCoreLowerThreadLocal.cpp
+++ b/llvm/lib/Target/XCore/XCoreLowerThreadLocal.cpp
@@ -31,9 +31,9 @@
using namespace llvm;
static cl::opt<unsigned> MaxThreads(
- "xcore-max-threads", cl::Optional,
- cl::desc("Maximum number of threads (for emulation thread-local storage)"),
- cl::Hidden, cl::value_desc("number"), cl::init(8));
+ "xcore-max-threads",
+ cl::desc("Maximum number of threads (for emulation thread-local storage)"),
+ cl::Hidden, cl::value_desc("number"), cl::init(8));
namespace {
/// Lowers thread local variables on the XCore. Each thread local variable is
diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
index 451a60c5b6ecd3..3e9b0b3d39c47b 100644
--- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -222,8 +222,7 @@ static cl::opt<bool> ClInstrumentWrites(
static cl::opt<bool>
ClUseStackSafety("asan-use-stack-safety", cl::Hidden, cl::init(true),
- cl::Hidden, cl::desc("Use Stack Safety analysis results"),
- cl::Optional);
+ cl::Hidden, cl::desc("Use Stack Safety analysis results"));
static cl::opt<bool> ClInstrumentAtomics(
"asan-instrument-atomics",
diff --git a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
index 230977540bf822..4de3941c5860d6 100644
--- a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -139,14 +139,12 @@ static cl::opt<bool> ClInstrumentStack("hwasan-instrument-stack",
static cl::opt<bool>
ClUseStackSafety("hwasan-use-stack-safety", cl::Hidden, cl::init(true),
- cl::Hidden, cl::desc("Use Stack Safety analysis results"),
- cl::Optional);
+ cl::Hidden, cl::desc("Use Stack Safety analysis results"));
static cl::opt<size_t> ClMaxLifetimes(
"hwasan-max-lifetimes-for-alloca", cl::Hidden, cl::init(3),
cl::ReallyHidden,
- cl::desc("How many lifetime ends to handle for a single alloca."),
- cl::Optional);
+ cl::desc("How many lifetime ends to handle for a single alloca."));
static cl::opt<bool>
ClUseAfterScope("hwasan-use-after-scope",
diff --git a/llvm/tools/llvm-cov/CodeCoverage.cpp b/llvm/tools/llvm-cov/CodeCoverage.cpp
index 892d25750004f4..abc9a898a52b96 100644
--- a/llvm/tools/llvm-cov/CodeCoverage.cpp
+++ b/llvm/tools/llvm-cov/CodeCoverage.cpp
@@ -660,31 +660,30 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) {
"object", cl::desc("Coverage executable or object file"));
cl::opt<bool> DebugDumpCollectedObjects(
- "dump-collected-objects", cl::Optional, cl::Hidden,
+ "dump-collected-objects", cl::Hidden,
cl::desc("Show the collected coverage object files"));
cl::list<std::string> InputSourceFiles("sources", cl::Positional,
cl::desc("<Source files>"));
cl::opt<bool> DebugDumpCollectedPaths(
- "dump-collected-paths", cl::Optional, cl::Hidden,
+ "dump-collected-paths", cl::Hidden,
cl::desc("Show the collected paths to source files"));
cl::opt<std::string> PGOFilename(
- "instr-profile", cl::Optional,
+ "instr-profile",
cl::desc(
"File with the profile data obtained after an instrumented run"));
cl::opt<bool> EmptyProfile(
- "empty-profile", cl::Optional,
+ "empty-profile",
cl::desc("Use a synthetic profile with no data to generate "
"baseline coverage"));
cl::list<std::string> Arches(
"arch", cl::desc("architectures of the coverage mapping binaries"));
- cl::opt<bool> DebugDump("dump", cl::Optional,
- cl::desc("Show internal debug dump"));
+ cl::opt<bool> DebugDump("dump", cl::desc("Show internal debug dump"));
cl::list<std::string> DebugFileDirectory(
"debug-file-directory",
@@ -705,61 +704,61 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) {
cl::init(CoverageViewOptions::OutputFormat::Text));
cl::list<std::string> PathRemaps(
- "path-equivalence", cl::Optional,
+ "path-equivalence",
cl::desc("<from>,<to> Map coverage data paths to local source file "
"paths"));
cl::OptionCategory FilteringCategory("Function filtering options");
cl::list<std::string> NameFilters(
- "name", cl::Optional,
+ "name",
cl::desc("Show code coverage only for functions with the given name"),
cl::cat(FilteringCategory));
cl::list<std::string> NameFilterFiles(
- "name-allowlist", cl::Optional,
+ "name-allowlist",
cl::desc("Show code coverage only for functions listed in the given "
"file"),
cl::cat(FilteringCategory));
cl::list<std::string> NameRegexFilters(
- "name-regex", cl::Optional,
+ "name-regex",
cl::desc("Show code coverage only for functions that match the given "
"regular expression"),
cl::cat(FilteringCategory));
cl::list<std::string> IgnoreFilenameRegexFilters(
- "ignore-filename-regex", cl::Optional,
+ "ignore-filename-regex",
cl::desc("Skip source code files with file paths that match the given "
"regular expression"),
cl::cat(FilteringCategory));
cl::list<std::string> IncludeFilenameRegexFilters(
- "include-filename-regex", cl::Optional,
+ "include-filename-regex",
cl::desc("Only include source code files with file paths that match the "
"given regular expression"),
cl::cat(FilteringCategory));
cl::opt<double> RegionCoverageLtFilter(
- "region-coverage-lt", cl::Optional,
+ "region-coverage-lt",
cl::desc("Show code coverage only for functions with region coverage "
"less than the given threshold"),
cl::cat(FilteringCategory));
cl::opt<double> RegionCoverageGtFilter(
- "region-coverage-gt", cl::Optional,
+ "region-coverage-gt",
cl::desc("Show code coverage only for functions with region coverage "
"greater than the given threshold"),
cl::cat(FilteringCategory));
cl::opt<double> LineCoverageLtFilter(
- "line-coverage-lt", cl::Optional,
+ "line-coverage-lt",
cl::desc("Show code coverage only for functions with line coverage less "
"than the given threshold"),
cl::cat(FilteringCategory));
cl::opt<double> LineCoverageGtFilter(
- "line-coverage-gt", cl::Optional,
+ "line-coverage-gt",
cl::desc("Show code coverage only for functions with line coverage "
"greater than the given threshold"),
cl::cat(FilteringCategory));
@@ -772,29 +771,28 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) {
"Xdemangler", cl::desc("<demangler-path>|<demangler-option>"));
cl::opt<bool> RegionSummary(
- "show-region-summary", cl::Optional,
- cl::desc("Show region statistics in summary table"),
- cl::init(true));
+ "show-region-summary",
+ cl::desc("Show region statistics in summary table"), cl::init(true));
cl::opt<bool> FunctionSummary(
- "show-function-summary", cl::Optional,
+ "show-function-summary",
cl::desc("Show function statistics in summary table"), cl::init(true));
cl::opt<bool> BranchSummary(
- "show-branch-summary", cl::Optional,
+ "show-branch-summary",
cl::desc("Show branch condition statistics in summary table"),
cl::init(true));
- cl::opt<bool> MCDCSummary("show-mcdc-summary", cl::Optional,
+ cl::opt<bool> MCDCSummary("show-mcdc-summary",
cl::desc("Show MCDC statistics in summary table"),
cl::init(false));
cl::opt<bool> InstantiationSummary(
- "show-instantiation-summary", cl::Optional,
+ "show-instantiation-summary",
cl::desc("Show instantiation statistics in summary table"));
cl::opt<bool> SummaryOnly(
- "summary-only", cl::Optional,
+ "summary-only",
cl::desc("Export only summary information for each source file"));
cl::opt<unsigned> NumThreads(
@@ -1005,18 +1003,16 @@ int CodeCoverageTool::doShow(int argc, const char **argv,
cl::OptionCategory ViewCategory("Viewing options");
cl::opt<bool> ShowLineExecutionCounts(
- "show-line-counts", cl::Optional,
- cl::desc("Show the execution counts for each line"), cl::init(true),
- cl::cat(ViewCategory));
+ "show-line-counts", cl::desc("Show the execution counts for each line"),
+ cl::init(true), cl::cat(ViewCategory));
cl::opt<bool> ShowRegions(
- "show-regions", cl::Optional,
- cl::desc("Show the execution counts for each region"),
+ "show-regions", cl::desc("Show the execution counts for each region"),
cl::cat(ViewCategory));
cl::opt<CoverageViewOptions::BranchOutputType> ShowBranches(
- "show-branches", cl::Optional,
- cl::desc("Show coverage for branch conditions"), cl::cat(ViewCategory),
+ "show-branches", cl::desc("Show coverage for branch conditions"),
+ cl::cat(ViewCategory),
cl::values(clEnumValN(CoverageViewOptions::BranchOutputType::Count,
"count", "Show True/False counts"),
clEnumValN(CoverageViewOptions::BranchOutputType::Percent,
@@ -1024,34 +1020,34 @@ int CodeCoverageTool::doShow(int argc, const char **argv,
cl::init(CoverageViewOptions::BranchOutputType::Off));
cl::opt<bool> ShowMCDC(
- "show-mcdc", cl::Optional,
+ "show-mcdc",
cl::desc("Show the MCDC Coverage for each applicable boolean expression"),
cl::cat(ViewCategory));
cl::opt<bool> ShowMCDCNonExecutedVectors(
- "show-mcdc-non-executed-vectors", cl::Optional,
+ "show-mcdc-non-executed-vectors",
cl::desc("Show MC/DC test vectors that were not executed"),
cl::cat(ViewCategory));
cl::opt<bool> ShowBestLineRegionsCounts(
- "show-line-counts-or-regions", cl::Optional,
+ "show-line-counts-or-regions",
cl::desc("Show the execution counts for each line, or the execution "
"counts for each region on lines that have multiple regions"),
cl::cat(ViewCategory));
- cl::opt<bool> ShowExpansions("show-expansions", cl::Optional,
+ cl::opt<bool> ShowExpansions("show-expansions",
cl::desc("Show expanded source regions"),
cl::cat(ViewCategory));
- cl::opt<bool> ShowInstantiations("show-instantiations", cl::Optional,
+ cl::opt<bool> ShowInstantiations("show-instantiations",
cl::desc("Show function instantiations"),
cl::init(true), cl::cat(ViewCategory));
- cl::opt<bool> ShowDirectoryCoverage("show-directory-coverage", cl::Optional,
+ cl::opt<bool> ShowDirectoryCoverage("show-directory-coverage",
cl::desc("Show directory coverage"),
cl::cat(ViewCategory));
- cl::opt<bool> ShowCreatedTime("show-created-time", cl::Optional,
+ cl::opt<bool> ShowCreatedTime("show-created-time",
cl::desc("Show created time for each page."),
cl::init(true), cl::cat(ViewCategory));
@@ -1062,7 +1058,7 @@ int CodeCoverageTool::doShow(int argc, const char **argv,
cl::aliasopt(ShowOutputDirectory));
cl::opt<bool> BinaryCounters(
- "binary-counters", cl::Optional,
+ "binary-counters",
cl::desc("Show binary counters (1/0) in lines and branches instead of "
"integer execution counts"),
cl::cat(ViewCategory));
@@ -1073,11 +1069,10 @@ int CodeCoverageTool::doShow(int argc, const char **argv,
"Set tab expansion size for html coverage reports (default = 2)"));
cl::opt<std::string> ProjectTitle(
- "project-title", cl::Optional,
- cl::desc("Set project title for the coverage report"));
+ "project-title", cl::desc("Set project title for the coverage report"));
cl::opt<std::string> CovWatermark(
- "coverage-watermark", cl::Optional,
+ "coverage-watermark",
cl::desc("<high>,<low> value indicate thresholds for high and low"
"coverage watermark"));
@@ -1265,7 +1260,7 @@ int CodeCoverageTool::doShow(int argc, const char **argv,
int CodeCoverageTool::doReport(int argc, const char **argv,
CommandLineParserType commandLineParser) {
cl::opt<bool> ShowFunctionSummaries(
- "show-functions", cl::Optional, cl::init(false),
+ "show-functions", cl::init(false),
cl::desc("Show coverage summaries for each function"));
auto Err = commandLineParser(argc, argv);
@@ -1315,24 +1310,24 @@ int CodeCoverageTool::doExport(int argc, const char **argv,
cl::OptionCategory ExportCategory("Exporting options");
- cl::opt<bool> SkipExpansions("skip-expansions", cl::Optional,
+ cl::opt<bool> SkipExpansions("skip-expansions",
cl::desc("Don't export expanded source regions"),
cl::cat(ExportCategory));
- cl::opt<bool> SkipFunctions("skip-functions", cl::Optional,
+ cl::opt<bool> SkipFunctions("skip-functions",
cl::desc("Don't export per-function data"),
cl::cat(ExportCategory));
- cl::opt<bool> SkipBranches("skip-branches", cl::Optional,
- cl::desc("Don't export branch data (LCOV)"),
- cl::cat(ExportCategory));
+ cl::opt<bool> SkipBranches("skip-branches",
+ cl::desc("Don't export branch data (LCOV)"),
+ cl::cat(ExportCategory));
- cl::opt<bool> UnifyInstantiations("unify-instantiations", cl::Optional,
+ cl::opt<bool> UnifyInstantiations("unify-instantiations",
cl::desc("Unify function instantiations"),
cl::init(true), cl::cat(ExportCategory));
cl::opt<bool> ShowMCDCNonExecutedVectors(
- "show-mcdc-non-executed-vectors", cl::Optional,
+ "show-mcdc-non-executed-vectors",
cl::desc("Include MC/DC test vectors that were not executed in the "
"export"),
cl::cat(ExportCategory));
diff --git a/llvm/tools/llvm-ir2vec/llvm-ir2vec.cpp b/llvm/tools/llvm-ir2vec/llvm-ir2vec.cpp
index 05d62b8ec6ff88..861cd849501623 100644
--- a/llvm/tools/llvm-ir2vec/llvm-ir2vec.cpp
+++ b/llvm/tools/llvm-ir2vec/llvm-ir2vec.cpp
@@ -131,7 +131,7 @@ static cl::opt<std::string> OutputFilename("o", cl::desc("Output filename"),
// Embedding-specific options
static cl::opt<std::string>
FunctionName("function", cl::desc("Process specific function only"),
- cl::value_desc("name"), cl::Optional, cl::init(""),
+ cl::value_desc("name"), cl::init(""),
cl::sub(EmbeddingsSubCmd), cl::cat(CommonCategory));
static cl::opt<EmbeddingLevel>
diff --git a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
index 2929cd57eea7fb..1160167c1cdad1 100644
--- a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
+++ b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
@@ -280,7 +280,7 @@ static cl::opt<std::string> ShowLinkGraphs(
"show-graphs",
cl::desc("Takes a posix regex and prints the link graphs of all files "
"matching that regex after fixups have been applied"),
- cl::Optional, cl::cat(JITLinkCategory));
+ cl::cat(JITLinkCategory));
static cl::opt<bool> ShowTimes("show-times",
cl::desc("Show times for llvm-jitlink phases"),
diff --git a/llvm/tools/llvm-lto2/llvm-lto2.cpp b/llvm/tools/llvm-lto2/llvm-lto2.cpp
index 0bdb190ca52982..e203afe0f03bd9 100644
--- a/llvm/tools/llvm-lto2/llvm-lto2.cpp
+++ b/llvm/tools/llvm-lto2/llvm-lto2.cpp
@@ -208,8 +208,7 @@ static cl::list<std::string>
cl::desc("Load passes from plugin library"));
static cl::opt<LTO::LTOKind> UnifiedLTOMode(
- "unified-lto", cl::Optional,
- cl::desc("Set LTO mode with the following options:"),
+ "unified-lto", cl::desc("Set LTO mode with the following options:"),
cl::values(clEnumValN(LTO::LTOK_UnifiedThin, "thin",
"ThinLTO with Unified LTO enabled"),
clEnumValN(LTO::LTOK_UnifiedRegular, "full",
diff --git a/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp b/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp
index 553866f4e9bc4d..4ca77cc9e9af12 100644
--- a/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp
+++ b/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp
@@ -431,7 +431,7 @@ cl::opt<uint32_t> ModuleIndex(
"mod",
cl::desc(
"Limit options in the Modules category to the specified module index"),
- cl::Optional, cl::sub(BytesSubcommand), cl::cat(ModuleCategory));
+ cl::sub(BytesSubcommand), cl::cat(ModuleCategory));
cl::opt<bool> ModuleSyms("syms", cl::desc("Dump symbol record substream"),
cl::sub(BytesSubcommand), cl::cat(ModuleCategory));
cl::opt<bool> ModuleC11("c11-chunks", cl::Hidden,
@@ -569,14 +569,14 @@ cl::opt<bool> DumpFpo("fpo", cl::desc("dump FPO records"),
cl::cat(SymbolOptions), cl::sub(DumpSubcommand));
cl::opt<uint32_t> DumpSymbolOffset(
- "symbol-offset", cl::Optional,
+ "symbol-offset",
cl::desc("only dump symbol record with the specified symbol offset"),
cl::cat(SymbolOptions), cl::sub(DumpSubcommand));
cl::opt<bool> DumpParents("show-parents",
cl::desc("dump the symbols record's all parents."),
cl::cat(SymbolOptions), cl::sub(DumpSubcommand));
cl::opt<uint32_t>
- DumpParentDepth("parent-recurse-depth", cl::Optional, cl::init(-1U),
+ DumpParentDepth("parent-recurse-depth", cl::init(-1U),
cl::desc("only recurse to a depth of N when displaying "
"parents of a symbol record."),
cl::cat(SymbolOptions), cl::sub(DumpSubcommand));
@@ -584,7 +584,7 @@ cl::opt<bool> DumpChildren("show-children",
cl::desc("dump the symbols record's all children."),
cl::cat(SymbolOptions), cl::sub(DumpSubcommand));
cl::opt<uint32_t>
- DumpChildrenDepth("children-recurse-depth", cl::Optional, cl::init(-1U),
+ DumpChildrenDepth("children-recurse-depth", cl::init(-1U),
cl::desc("only recurse to a depth of N when displaying "
"children of a symbol record."),
cl::cat(SymbolOptions), cl::sub(DumpSubcommand));
@@ -614,11 +614,11 @@ cl::opt<bool> DumpXme(
cl::desc(
"dump cross module exports (DEBUG_S_CROSSSCOPEEXPORTS subsection)"),
cl::cat(FileOptions), cl::sub(DumpSubcommand));
-cl::opt<uint32_t> DumpModi("modi", cl::Optional,
+cl::opt<uint32_t> DumpModi("modi",
cl::desc("For all options that iterate over "
"modules, limit to the specified module"),
cl::cat(FileOptions), cl::sub(DumpSubcommand));
-cl::opt<bool> JustMyCode("jmc", cl::Optional,
+cl::opt<bool> JustMyCode("jmc",
cl::desc("For all options that iterate over modules, "
"ignore modules from system libraries"),
cl::cat(FileOptions), cl::sub(DumpSubcommand));
@@ -764,7 +764,7 @@ cl::list<uint64_t> Offsets("offset", cl::desc("The file offset to explain"),
cl::opt<InputFileType> InputType(
"input-type", cl::desc("Specify how to interpret the input file"),
- cl::init(InputFileType::PDBFile), cl::Optional, cl::sub(ExplainSubcommand),
+ cl::init(InputFileType::PDBFile), cl::sub(ExplainSubcommand),
cl::values(clEnumValN(InputFileType::PDBFile, "pdb-file",
"Treat input as a PDB file (default)"),
clEnumValN(InputFileType::PDBStream, "pdb-stream",
@@ -786,18 +786,16 @@ cl::opt<std::string> OutputFile("out",
cl::desc("The file to write the stream to"),
cl::Required, cl::sub(ExportSubcommand));
cl::opt<std::string>
- Stream("stream", cl::Optional,
+ Stream("stream",
cl::desc("The index or name of the stream whose contents to export"),
cl::sub(ExportSubcommand));
cl::opt<bool> ForceName("name",
cl::desc("Force the interpretation of -stream as a "
"string, even if it is a valid integer"),
- cl::sub(ExportSubcommand), cl::Optional,
- cl::init(false));
+ cl::sub(ExportSubcommand), cl::init(false));
cl::opt<bool> DXContainer("dxcontainer",
cl::desc("Export DirectX Container, if present"),
- cl::sub(ExportSubcommand), cl::Optional,
- cl::init(false));
+ cl::sub(ExportSubcommand), cl::init(false));
} // namespace exportstream
}
diff --git a/llvm/tools/llvm-profgen/ProfileGenerator.cpp b/llvm/tools/llvm-profgen/ProfileGenerator.cpp
index 97643c1aa17089..efc2d91bbb0640 100644
--- a/llvm/tools/llvm-profgen/ProfileGenerator.cpp
+++ b/llvm/tools/llvm-profgen/ProfileGenerator.cpp
@@ -95,10 +95,10 @@ static cl::opt<double> ProfileDensityThreshold(
"profile-density-threshold", cl::init(50),
cl::desc("If the profile density is below the given threshold, it "
"will be suggested to increase the sampling rate."),
- cl::Optional, cl::cat(ProfGenCategory));
+ cl::cat(ProfGenCategory));
static cl::opt<bool> ShowDensity("show-density", cl::init(false),
cl::desc("show profile density details"),
- cl::Optional, cl::cat(ProfGenCategory));
+ cl::cat(ProfGenCategory));
static cl::opt<int> ProfileDensityCutOffHot(
"profile-density-cutoff-hot", cl::init(990000),
cl::desc("Total samples cutoff for functions used to calculate "
@@ -108,7 +108,7 @@ static cl::opt<int> ProfileDensityCutOffHot(
static cl::opt<bool> UpdateTotalSamples(
"update-total-samples", cl::init(false),
cl::desc("Update total samples by accumulating all its body samples."),
- cl::Optional, cl::cat(ProfGenCategory));
+ cl::cat(ProfGenCategory));
static cl::opt<bool> GenCSNestedProfile(
"gen-cs-nested-profile", cl::Hidden, cl::init(true),
@@ -118,7 +118,7 @@ cl::opt<bool> InferMissingFrames(
"infer-missing-frames", cl::init(true),
cl::desc(
"Infer missing call frames due to compiler tail call elimination."),
- cl::Optional, cl::cat(ProfGenCategory));
+ cl::cat(ProfGenCategory));
namespace sampleprof {
diff --git a/llvm/tools/llvm-split/llvm-split.cpp b/llvm/tools/llvm-split/llvm-split.cpp
index 4ead6fd4b88be8..7c00469ddae0da 100644
--- a/llvm/tools/llvm-split/llvm-split.cpp
+++ b/llvm/tools/llvm-split/llvm-split.cpp
@@ -87,7 +87,7 @@ static cl::opt<SplitByCategoryType> SplitByCategory(
"split-by-category",
cl::desc("Split by category. If present, splitting by category is used "
"with the specified categorization type."),
- cl::Optional, cl::init(SplitByCategoryType::SBCT_None),
+ cl::init(SplitByCategoryType::SBCT_None),
cl::values(clEnumValN(SplitByCategoryType::SBCT_ByAttribute, "attribute",
"one output module per unique value of the function "
"attribute named by --category-attribute"),
diff --git a/llvm/tools/llvm-undname/llvm-undname.cpp b/llvm/tools/llvm-undname/llvm-undname.cpp
index 42fffeb9c1e45b..f06ab494a9d8e3 100644
--- a/llvm/tools/llvm-undname/llvm-undname.cpp
+++ b/llvm/tools/llvm-undname/llvm-undname.cpp
@@ -30,31 +30,30 @@ using namespace llvm;
static cl::OptionCategory UndNameCategory("UndName Options");
-static cl::opt<bool> DumpBackReferences("backrefs", cl::Optional,
+static cl::opt<bool> DumpBackReferences("backrefs",
cl::desc("dump backreferences"),
cl::Hidden, cl::init(false),
cl::cat(UndNameCategory));
-static cl::opt<bool> NoAccessSpecifier("no-access-specifier", cl::Optional,
+static cl::opt<bool> NoAccessSpecifier("no-access-specifier",
cl::desc("skip access specifiers"),
cl::Hidden, cl::init(false),
cl::cat(UndNameCategory));
-static cl::opt<bool> NoCallingConvention("no-calling-convention", cl::Optional,
+static cl::opt<bool> NoCallingConvention("no-calling-convention",
cl::desc("skip calling convention"),
cl::Hidden, cl::init(false),
cl::cat(UndNameCategory));
-static cl::opt<bool> NoReturnType("no-return-type", cl::Optional,
+static cl::opt<bool> NoReturnType("no-return-type",
cl::desc("skip return types"), cl::Hidden,
cl::init(false), cl::cat(UndNameCategory));
-static cl::opt<bool> NoMemberType("no-member-type", cl::Optional,
+static cl::opt<bool> NoMemberType("no-member-type",
cl::desc("skip member types"), cl::Hidden,
cl::init(false), cl::cat(UndNameCategory));
-static cl::opt<bool> NoVariableType("no-variable-type", cl::Optional,
+static cl::opt<bool> NoVariableType("no-variable-type",
cl::desc("skip variable types"), cl::Hidden,
cl::init(false), cl::cat(UndNameCategory));
-static cl::opt<std::string> RawFile("raw-file", cl::Optional,
- cl::desc("for fuzzer data"), cl::Hidden,
- cl::cat(UndNameCategory));
-static cl::opt<bool> WarnTrailing("warn-trailing", cl::Optional,
+static cl::opt<std::string> RawFile("raw-file", cl::desc("for fuzzer data"),
+ cl::Hidden, cl::cat(UndNameCategory));
+static cl::opt<bool> WarnTrailing("warn-trailing",
cl::desc("warn on trailing characters"),
cl::Hidden, cl::init(false),
cl::cat(UndNameCategory));
diff --git a/mlir/lib/Debug/DebugCounter.cpp b/mlir/lib/Debug/DebugCounter.cpp
index 879f6c9365cf6c..544dec04fab55d 100644
--- a/mlir/lib/Debug/DebugCounter.cpp
+++ b/mlir/lib/Debug/DebugCounter.cpp
@@ -31,7 +31,7 @@ struct DebugCounterOptions {
llvm::cl::CommaSeparated};
llvm::cl::opt<bool> printCounterInfo{
- "mlir-print-debug-counter", llvm::cl::init(false), llvm::cl::Optional,
+ "mlir-print-debug-counter", llvm::cl::init(false),
llvm::cl::desc("Print out debug counter information after all counters "
"have been accumulated")};
};
diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp
index f0bb8ef35e5e05..e47d8602547c8b 100644
--- a/polly/lib/Analysis/ScopInfo.cpp
+++ b/polly/lib/Analysis/ScopInfo.cpp
@@ -157,9 +157,10 @@ static cl::opt<bool, true> XUseInstructionNames(
cl::desc("Use LLVM-IR names when deriving statement names"),
cl::location(UseInstructionNames), cl::Hidden, cl::cat(PollyCategory));
-static cl::opt<bool> PollyPrintInstructions(
- "polly-print-instructions", cl::desc("Output instructions per ScopStmt"),
- cl::Hidden, cl::Optional, cl::init(false), cl::cat(PollyCategory));
+static cl::opt<bool>
+ PollyPrintInstructions("polly-print-instructions",
+ cl::desc("Output instructions per ScopStmt"),
+ cl::Hidden, cl::init(false), cl::cat(PollyCategory));
static cl::list<std::string> IslArgs("polly-isl-arg",
cl::value_desc("argument"),
diff --git a/polly/lib/CodeGen/LoopGenerators.cpp b/polly/lib/CodeGen/LoopGenerators.cpp
index df6fd9df1294d7..22af6f76f208ec 100644
--- a/polly/lib/CodeGen/LoopGenerators.cpp
+++ b/polly/lib/CodeGen/LoopGenerators.cpp
@@ -52,14 +52,13 @@ static cl::opt<OMPGeneralSchedulingType, true> XPollyScheduling(
clEnumValN(OMPGeneralSchedulingType::Runtime, "runtime",
"Runtime determined (OMP_SCHEDULE)")),
cl::Hidden, cl::location(polly::PollyScheduling),
- cl::init(OMPGeneralSchedulingType::Runtime), cl::Optional,
- cl::cat(PollyCategory));
+ cl::init(OMPGeneralSchedulingType::Runtime), cl::cat(PollyCategory));
static cl::opt<int, true>
XPollyChunkSize("polly-scheduling-chunksize",
cl::desc("Chunksize to use by the OpenMP runtime calls"),
cl::Hidden, cl::location(polly::PollyChunkSize),
- cl::init(0), cl::Optional, cl::cat(PollyCategory));
+ cl::init(0), cl::cat(PollyCategory));
// We generate a loop of either of the following structures:
//
More information about the llvm-commits
mailing list