https://github.com/MaskRay updated 
https://github.com/llvm/llvm-project/pull/225628

>From 59b7d7b4645567ebe703566ae9b15bca59ec1b03 Mon Sep 17 00:00:00 2001
From: Fangrui Song <[email protected]>
Date: Wed, 23 Sep 2026 00:26:11 -0700
Subject: [PATCH] Remove unneeded cl::Optional and cl::ZeroOrMore. NFC

cl::Optional and cl::ZeroOrMore have been no-op since
https://reviews.llvm.org/D120455 removed the "may only occur zero or one
times!" error.

LLM-aided
---
 bolt/lib/Core/BinaryContext.cpp               |  6 +-
 bolt/lib/Core/BinaryFunction.cpp              |  3 +-
 bolt/lib/Core/BinaryFunctionProfile.cpp       |  2 +-
 bolt/lib/Core/DynoStats.cpp                   |  1 -
 bolt/lib/Passes/BinaryPasses.cpp              | 11 +--
 bolt/lib/Passes/FrameAnalysis.cpp             |  2 +-
 bolt/lib/Passes/FrameOptimizer.cpp            |  1 -
 bolt/lib/Passes/IdenticalCodeFolding.cpp      |  3 +-
 bolt/lib/Passes/IndirectCallPromotion.cpp     |  2 +-
 bolt/lib/Passes/Instrumentation.cpp           | 22 ++---
 bolt/lib/Passes/JTFootprintReduction.cpp      |  2 +-
 bolt/lib/Passes/PLTCall.cpp                   |  2 +-
 bolt/lib/Passes/ProfileQualityStats.cpp       |  4 +-
 bolt/lib/Passes/ReorderAlgorithm.cpp          |  2 +-
 bolt/lib/Passes/ReorderData.cpp               |  1 -
 bolt/lib/Passes/ReorderFunctions.cpp          |  6 +-
 bolt/lib/Passes/RetpolineInsertion.cpp        |  4 +-
 bolt/lib/Passes/ShrinkWrapping.cpp            |  2 +-
 bolt/lib/Passes/StokeInfo.cpp                 |  1 -
 bolt/lib/Passes/TailDuplication.cpp           |  4 +-
 bolt/lib/Profile/DataAggregator.cpp           |  6 +-
 bolt/lib/Rewrite/BinaryPassManager.cpp        | 20 ++--
 bolt/lib/Rewrite/DWARFRewriter.cpp            |  3 +-
 bolt/lib/Rewrite/RewriteInstance.cpp          |  6 +-
 .../Target/AArch64/AArch64MCPlusBuilder.cpp   |  2 +-
 bolt/lib/Utils/CommandLineOpts.cpp            | 27 +++---
 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/CodeGen/CoverageMappingGen.cpp      |  1 -
 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 -
 llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp     |  2 +-
 .../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 +-
 llvm/lib/Transforms/IPO/Instrumentor.cpp      |  2 +-
 .../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          |  7 +-
 polly/lib/Support/PollyDebug.cpp              |  2 +-
 polly/lib/Transform/MatmulOptimizer.cpp       |  6 +-
 polly/lib/Transform/ScheduleOptimizer.cpp     |  3 +-
 72 files changed, 206 insertions(+), 249 deletions(-)

diff --git a/bolt/lib/Core/BinaryContext.cpp b/bolt/lib/Core/BinaryContext.cpp
index ae320ab695af3..8e479b92bc75b 100644
--- a/bolt/lib/Core/BinaryContext.cpp
+++ b/bolt/lib/Core/BinaryContext.cpp
@@ -65,7 +65,6 @@ static cl::opt<bool>
 PrintDebugInfo("print-debug-info",
   cl::desc("print debug info when printing functions"),
   cl::Hidden,
-  cl::ZeroOrMore,
   cl::cat(BoltCategory));
 
 cl::opt<bool> PrintRelocations(
@@ -77,7 +76,6 @@ static cl::opt<bool>
 PrintMemData("print-mem-data",
   cl::desc("print memory data annotations when printing functions"),
   cl::Hidden,
-  cl::ZeroOrMore,
   cl::cat(BoltCategory));
 
 cl::opt<std::string> CompDirOverride(
@@ -90,12 +88,12 @@ cl::opt<std::string> CompDirOverride(
 static cl::opt<bool> CloneConstantIsland("clone-constant-island",
                                          cl::desc("clone constant islands"),
                                          cl::Hidden, cl::init(true),
-                                         cl::ZeroOrMore, 
cl::cat(BoltCategory));
+                                         cl::cat(BoltCategory));
 
 static cl::opt<bool>
     FailOnInvalidPadding("fail-on-invalid-padding", cl::Hidden, 
cl::init(false),
                          cl::desc("treat invalid code padding as error"),
-                         cl::ZeroOrMore, cl::cat(BoltCategory));
+                         cl::cat(BoltCategory));
 
 static cl::opt<bool> DropDWOPageCache(
     "drop-dwo-page-cache",
diff --git a/bolt/lib/Core/BinaryFunction.cpp b/bolt/lib/Core/BinaryFunction.cpp
index 39c4dd5595e3c..69eec01e098c1 100644
--- a/bolt/lib/Core/BinaryFunction.cpp
+++ b/bolt/lib/Core/BinaryFunction.cpp
@@ -103,7 +103,6 @@ JumpTables("jump-tables",
       clEnumValN(JTS_AGGRESSIVE, "aggressive",
                  "aggressively split jump tables section based on usage "
                  "of the tables")),
-  cl::ZeroOrMore,
   cl::cat(BoltOptCategory));
 
 static cl::opt<bool> NoScan(
@@ -141,7 +140,7 @@ static cl::opt<bool> TrapOnAVX512(
     "trap-avx512",
     cl::desc("in relocation mode trap upon entry to any function that uses "
              "AVX-512 instructions"),
-    cl::init(false), cl::ZeroOrMore, cl::Hidden, cl::cat(BoltCategory));
+    cl::init(false), cl::Hidden, cl::cat(BoltCategory));
 
 bool shouldPrint(const BinaryFunction &Function) {
   // PLT stubs are disassembled for BTI binaries, therefore they should be
diff --git a/bolt/lib/Core/BinaryFunctionProfile.cpp 
b/bolt/lib/Core/BinaryFunctionProfile.cpp
index 94091063833c8..b58fba5895c97 100644
--- a/bolt/lib/Core/BinaryFunctionProfile.cpp
+++ b/bolt/lib/Core/BinaryFunctionProfile.cpp
@@ -36,7 +36,7 @@ cl::opt<IndirectCallPromotionType> ICP(
         clEnumValN(ICP_JUMP_TABLES, "jump-tables",
                    "perform ICP on jump tables"),
         clEnumValN(ICP_ALL, "all", "perform ICP on calls and jump tables")),
-    cl::ZeroOrMore, cl::cat(BoltOptCategory));
+    cl::cat(BoltOptCategory));
 
 static cl::alias ICPAlias("icp",
                           cl::desc("Alias for --indirect-call-promotion"),
diff --git a/bolt/lib/Core/DynoStats.cpp b/bolt/lib/Core/DynoStats.cpp
index 64a6d12b76e82..4a8f4e7227124 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 4bb3f0988de6b..b36674344b17f 100644
--- a/bolt/lib/Passes/BinaryPasses.cpp
+++ b/bolt/lib/Passes/BinaryPasses.cpp
@@ -79,7 +79,6 @@ HotTextMoveSections("hot-text-move-sections",
            "the hot text. (default=\'.stub,.mover\')."),
   cl::value_desc("sec1,sec2,sec3,..."),
   cl::CommaSeparated,
-  cl::ZeroOrMore,
   cl::cat(BoltCategory));
 
 bool isHotTextMover(const BinaryFunction &Function) {
@@ -110,7 +109,7 @@ static cl::list<Peepholes::PeepholeOpts> Peepholes(
                           "remove useless conditional branches"),
                clEnumValN(Peepholes::PEEP_ALL, "all",
                           "enable all peephole optimizations")),
-    cl::ZeroOrMore, cl::cat(BoltOptCategory));
+    cl::cat(BoltOptCategory));
 
 static cl::opt<unsigned>
     PrintFuncStat("print-function-statistics",
@@ -135,7 +134,7 @@ static cl::list<bolt::DynoStats::Category>
 #undef D
                           clEnumValN(bolt::DynoStats::LAST_DYNO_STAT, "all",
                                      "sorted by all names")),
-                  cl::ZeroOrMore, cl::cat(BoltOptCategory));
+                  cl::cat(BoltOptCategory));
 
 static cl::opt<bool>
     PrintUnknown("print-unknown",
@@ -173,7 +172,7 @@ cl::opt<bolt::ReorderBasicBlocks::LayoutType> ReorderBlocks(
                    "perform layout optimizing I-cache behavior"),
         clEnumValN(bolt::ReorderBasicBlocks::LT_OPTIMIZE_SHUFFLE,
                    "cluster-shuffle", "perform random layout of clusters")),
-    cl::ZeroOrMore, cl::cat(BoltOptCategory),
+    cl::cat(BoltOptCategory),
     cl::callback([](const bolt::ReorderBasicBlocks::LayoutType &option) {
       if (option == bolt::ReorderBasicBlocks::LT_OPTIMIZE_CACHE_PLUS) {
         errs() << "BOLT-WARNING: '-reorder-blocks=cache+' is deprecated, 
please"
@@ -210,7 +209,6 @@ SctcMode("sctc-mode",
     clEnumValN(SctcHeuristic,
       "heuristic",
       "use branch prediction data to control sctc")),
-  cl::ZeroOrMore,
   cl::cat(BoltOptCategory));
 
 static cl::opt<unsigned>
@@ -243,8 +241,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/FrameAnalysis.cpp 
b/bolt/lib/Passes/FrameAnalysis.cpp
index 0b26da3371234..b5a50417285ba 100644
--- a/bolt/lib/Passes/FrameAnalysis.cpp
+++ b/bolt/lib/Passes/FrameAnalysis.cpp
@@ -41,7 +41,7 @@ static cl::opt<bool> TimeFA("time-fa", cl::desc("time frame 
analysis steps"),
 static cl::opt<bool>
     ExperimentalSW("experimental-shrink-wrapping",
                    cl::desc("process functions with stack pointer arithmetic"),
-                   cl::ReallyHidden, cl::ZeroOrMore, cl::cat(BoltOptCategory));
+                   cl::ReallyHidden, cl::cat(BoltOptCategory));
 
 bool shouldFrameOptimize(const llvm::bolt::BinaryFunction &Function) {
   if (Function.hasUnknownControlFlow())
diff --git a/bolt/lib/Passes/FrameOptimizer.cpp 
b/bolt/lib/Passes/FrameOptimizer.cpp
index b0b7207feac01..344c6a234e0c4 100644
--- a/bolt/lib/Passes/FrameOptimizer.cpp
+++ b/bolt/lib/Passes/FrameOptimizer.cpp
@@ -40,7 +40,6 @@ FrameOptimization("frame-opt",
     clEnumValN(FOP_NONE, "none", "do not perform frame optimization"),
     clEnumValN(FOP_HOT, "hot", "perform FOP on hot functions"),
     clEnumValN(FOP_ALL, "all", "perform FOP on all functions")),
-  cl::ZeroOrMore,
   cl::cat(BoltOptCategory));
 
 static cl::opt<bool> RemoveStores(
diff --git a/bolt/lib/Passes/IdenticalCodeFolding.cpp 
b/bolt/lib/Passes/IdenticalCodeFolding.cpp
index 18c901e45116f..0c8f01e103a4b 100644
--- a/bolt/lib/Passes/IdenticalCodeFolding.cpp
+++ b/bolt/lib/Passes/IdenticalCodeFolding.cpp
@@ -43,7 +43,6 @@ static cl::opt<bool>
 TimeICF("time-icf",
   cl::desc("time icf steps"),
   cl::ReallyHidden,
-  cl::ZeroOrMore,
   cl::cat(BoltOptCategory));
 
 cl::opt<bolt::IdenticalCodeFolding::ICFLevel, false,
@@ -63,7 +62,7 @@ cl::opt<bolt::IdenticalCodeFolding::ICFLevel, false,
                               "Disable identical code folding (default)"),
                    clEnumValN(bolt::IdenticalCodeFolding::ICFLevel::Safe,
                               "safe", "Enable safe identical code folding")),
-        cl::ZeroOrMore, cl::ValueOptional, cl::cat(BoltOptCategory));
+        cl::ValueOptional, cl::cat(BoltOptCategory));
 } // namespace opts
 
 bool IdenticalCodeFolding::shouldOptimize(const BinaryFunction &BF) const {
diff --git a/bolt/lib/Passes/IndirectCallPromotion.cpp 
b/bolt/lib/Passes/IndirectCallPromotion.cpp
index 39ae4cda145c4..3384dba63453c 100644
--- a/bolt/lib/Passes/IndirectCallPromotion.cpp
+++ b/bolt/lib/Passes/IndirectCallPromotion.cpp
@@ -39,7 +39,7 @@ static cl::opt<unsigned> ICPJTRemainingPercentThreshold(
     "icp-jt-remaining-percent-threshold",
     cl::desc("The percentage threshold against remaining unpromoted indirect "
              "call count for the promotion for jump tables"),
-    cl::init(30), cl::ZeroOrMore, cl::Hidden, cl::cat(BoltOptCategory));
+    cl::init(30), cl::Hidden, cl::cat(BoltOptCategory));
 
 static cl::opt<unsigned> ICPJTTotalPercentThreshold(
     "icp-jt-total-percent-threshold",
diff --git a/bolt/lib/Passes/Instrumentation.cpp 
b/bolt/lib/Passes/Instrumentation.cpp
index ffcfb26415971..581d720d07db5 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/JTFootprintReduction.cpp 
b/bolt/lib/Passes/JTFootprintReduction.cpp
index afd6c0953b906..f33481397543a 100644
--- a/bolt/lib/Passes/JTFootprintReduction.cpp
+++ b/bolt/lib/Passes/JTFootprintReduction.cpp
@@ -32,7 +32,7 @@ static cl::opt<bool> JTFootprintOnlyPIC(
     "jt-footprint-optimize-for-icache",
     cl::desc("with jt-footprint-reduction, only process PIC jumptables and 
turn"
              " off other transformations that increase code size"),
-    cl::init(false), cl::ZeroOrMore, cl::cat(BoltOptCategory));
+    cl::init(false), cl::cat(BoltOptCategory));
 
 } // namespace opts
 
diff --git a/bolt/lib/Passes/PLTCall.cpp b/bolt/lib/Passes/PLTCall.cpp
index a41b3870af666..c9b66c6fff927 100644
--- a/bolt/lib/Passes/PLTCall.cpp
+++ b/bolt/lib/Passes/PLTCall.cpp
@@ -33,7 +33,7 @@ static cl::opt<bolt::PLTCall::OptType>
                               "optimize executed (hot) PLT calls"),
                    clEnumValN(bolt::PLTCall::OT_ALL, "all",
                               "optimize all PLT calls")),
-        cl::ZeroOrMore, cl::cat(BoltOptCategory));
+        cl::cat(BoltOptCategory));
 }
 
 namespace llvm {
diff --git a/bolt/lib/Passes/ProfileQualityStats.cpp 
b/bolt/lib/Passes/ProfileQualityStats.cpp
index f88133714e206..877f689f8d449 100644
--- a/bolt/lib/Passes/ProfileQualityStats.cpp
+++ b/bolt/lib/Passes/ProfileQualityStats.cpp
@@ -29,12 +29,12 @@ static cl::opt<unsigned> TopFunctionsForProfileQualityCheck(
     "top-functions-for-profile-quality-check",
     cl::desc("number of hottest functions to print aggregated "
              "profile quality stats of."),
-    cl::init(1000), cl::ZeroOrMore, cl::Hidden, cl::cat(BoltOptCategory));
+    cl::init(1000), cl::Hidden, cl::cat(BoltOptCategory));
 static cl::opt<unsigned> PercentileForProfileQualityCheck(
     "percentile-for-profile-quality-check",
     cl::desc("Percentile of profile quality distributions over hottest "
              "functions to report."),
-    cl::init(95), cl::ZeroOrMore, cl::Hidden, cl::cat(BoltOptCategory));
+    cl::init(95), cl::Hidden, cl::cat(BoltOptCategory));
 } // namespace opts
 
 namespace {
diff --git a/bolt/lib/Passes/ReorderAlgorithm.cpp 
b/bolt/lib/Passes/ReorderAlgorithm.cpp
index 8fa6b2c53dc87..eb6cfabf4014f 100644
--- a/bolt/lib/Passes/ReorderAlgorithm.cpp
+++ b/bolt/lib/Passes/ReorderAlgorithm.cpp
@@ -37,7 +37,7 @@ static cl::opt<unsigned> ColdThreshold(
              "threshold when evaluating whether a basic block is cold "
              "(0 means it is only considered cold if the block has zero "
              "samples). Default: 0 "),
-    cl::init(0), cl::ZeroOrMore, cl::Hidden, cl::cat(BoltOptCategory));
+    cl::init(0), cl::Hidden, cl::cat(BoltOptCategory));
 
 static cl::opt<bool> PrintClusters("print-clusters", cl::desc("print 
clusters"),
                                    cl::Hidden, cl::cat(BoltOptCategory));
diff --git a/bolt/lib/Passes/ReorderData.cpp b/bolt/lib/Passes/ReorderData.cpp
index cdb38021965f5..a9fb80e645681 100644
--- a/bolt/lib/Passes/ReorderData.cpp
+++ b/bolt/lib/Passes/ReorderData.cpp
@@ -52,7 +52,6 @@ ReorderAlgorithm("reorder-data-algo",
     clEnumValN(REORDER_FUNCS,
       "funcs",
       "sort hot data by hot function usage and count")),
-  cl::ZeroOrMore,
   cl::cat(BoltOptCategory));
 
 static cl::opt<unsigned>
diff --git a/bolt/lib/Passes/ReorderFunctions.cpp 
b/bolt/lib/Passes/ReorderFunctions.cpp
index f38f502e75ced..9fbf73078a537 100644
--- a/bolt/lib/Passes/ReorderFunctions.cpp
+++ b/bolt/lib/Passes/ReorderFunctions.cpp
@@ -53,7 +53,7 @@ cl::opt<bolt::ReorderFunctions::ReorderType> ReorderFunctions(
                           "reorder functions randomly"),
                clEnumValN(bolt::ReorderFunctions::RT_USER, "user",
                           "use function order specified by -function-order")),
-    cl::ZeroOrMore, cl::cat(BoltOptCategory),
+    cl::cat(BoltOptCategory),
     cl::callback([](const bolt::ReorderFunctions::ReorderType &option) {
       if (option == bolt::ReorderFunctions::RT_HFSORT_PLUS) {
         errs() << "BOLT-WARNING: '-reorder-functions=hfsort+' is deprecated,"
@@ -94,7 +94,7 @@ static cl::opt<bool> CgFromPerfData(
     "cg-from-perf-data",
     cl::desc("use perf data directly when constructing the call graph"
              " for stale functions"),
-    cl::init(true), cl::ZeroOrMore, cl::cat(BoltOptCategory));
+    cl::init(true), cl::cat(BoltOptCategory));
 
 static cl::opt<bool> CgIgnoreRecursiveCalls(
     "cg-ignore-recursive-calls",
@@ -105,7 +105,7 @@ static cl::opt<bool> CgUseSplitHotSize(
     "cg-use-split-hot-size",
     cl::desc("use hot/cold data on basic blocks to determine hot sizes for "
              "call graph functions"),
-    cl::init(false), cl::ZeroOrMore, cl::cat(BoltOptCategory));
+    cl::init(false), cl::cat(BoltOptCategory));
 
 } // namespace opts
 
diff --git a/bolt/lib/Passes/RetpolineInsertion.cpp 
b/bolt/lib/Passes/RetpolineInsertion.cpp
index 4000e59e80ba2..9c3ff80ed6a8c 100644
--- a/bolt/lib/Passes/RetpolineInsertion.cpp
+++ b/bolt/lib/Passes/RetpolineInsertion.cpp
@@ -42,7 +42,7 @@ static llvm::cl::opt<bool>
 static llvm::cl::opt<bool> RetpolineLfence(
     "retpoline-lfence",
     cl::desc("determine if lfence instruction should exist in the retpoline"),
-    cl::init(true), cl::ZeroOrMore, cl::Hidden, cl::cat(BoltCategory));
+    cl::init(true), cl::Hidden, cl::cat(BoltCategory));
 
 static cl::opt<RetpolineInsertion::AvailabilityOptions> R11Availability(
     "r11-availability",
@@ -54,7 +54,7 @@ static cl::opt<RetpolineInsertion::AvailabilityOptions> 
R11Availability(
                           "always", "r11 available before calls and jumps"),
                clEnumValN(RetpolineInsertion::AvailabilityOptions::ABI, "abi",
                           "r11 available before calls but not before jumps")),
-    cl::ZeroOrMore, cl::cat(BoltCategory));
+    cl::cat(BoltCategory));
 
 } // namespace opts
 
diff --git a/bolt/lib/Passes/ShrinkWrapping.cpp 
b/bolt/lib/Passes/ShrinkWrapping.cpp
index 5f0af2d68182f..e9345a2c033a3 100644
--- a/bolt/lib/Passes/ShrinkWrapping.cpp
+++ b/bolt/lib/Passes/ShrinkWrapping.cpp
@@ -32,7 +32,7 @@ static cl::opt<unsigned> ShrinkWrappingThreshold(
     cl::desc("Percentage of prologue execution count to use as threshold when"
              " evaluating whether a block is cold enough to be profitable to"
              " move eligible spills there"),
-    cl::init(30), cl::ZeroOrMore, cl::cat(BoltOptCategory));
+    cl::init(30), cl::cat(BoltOptCategory));
 } // namespace opts
 
 namespace llvm {
diff --git a/bolt/lib/Passes/StokeInfo.cpp b/bolt/lib/Passes/StokeInfo.cpp
index 05cdf63a4af18..c3afe21775cb7 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/Passes/TailDuplication.cpp 
b/bolt/lib/Passes/TailDuplication.cpp
index a4a5876943ec4..c8c9298805268 100644
--- a/bolt/lib/Passes/TailDuplication.cpp
+++ b/bolt/lib/Passes/TailDuplication.cpp
@@ -38,7 +38,7 @@ static cl::opt<bolt::TailDuplication::DuplicationMode> 
TailDuplicationMode(
                           "moderate strategy"),
                clEnumValN(bolt::TailDuplication::TD_CACHE, "cache",
                           "cache-aware duplication strategy")),
-    cl::ZeroOrMore, cl::Hidden, cl::cat(BoltOptCategory));
+    cl::Hidden, cl::cat(BoltOptCategory));
 
 static cl::opt<unsigned>
     TailDuplicationMinimumOffset("tail-duplication-minimum-offset",
@@ -51,7 +51,7 @@ static cl::opt<unsigned> TailDuplicationMaximumDuplication(
     "tail-duplication-maximum-duplication",
     cl::desc("tail blocks whose size (in bytes) exceeds the value are never "
              "duplicated"),
-    cl::ZeroOrMore, cl::ReallyHidden, cl::init(24), cl::cat(BoltOptCategory));
+    cl::ReallyHidden, cl::init(24), cl::cat(BoltOptCategory));
 
 static cl::opt<unsigned> TailDuplicationMinimumDuplication(
     "tail-duplication-minimum-duplication",
diff --git a/bolt/lib/Profile/DataAggregator.cpp 
b/bolt/lib/Profile/DataAggregator.cpp
index 9f4d988ed0c0e..a18e4d3d3a0d2 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -88,12 +88,12 @@ static cl::list<unsigned long long>
     FilterPID("pid",
               cl::desc("only use samples from process with specified PID(s) "
                        "(comma-separated)"),
-              cl::CommaSeparated, cl::ZeroOrMore, cl::cat(AggregatorCategory));
+              cl::CommaSeparated, cl::cat(AggregatorCategory));
 
 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));
 
@@ -139,7 +138,6 @@ static cl::opt<bool>
 TimeAggregator("time-aggr",
   cl::desc("time BOLT aggregator"),
   cl::init(false),
-  cl::ZeroOrMore,
   cl::cat(AggregatorCategory));
 
 } // namespace opts
diff --git a/bolt/lib/Rewrite/BinaryPassManager.cpp 
b/bolt/lib/Rewrite/BinaryPassManager.cpp
index dbbedea2f70bc..11e91630a612d 100644
--- a/bolt/lib/Rewrite/BinaryPassManager.cpp
+++ b/bolt/lib/Rewrite/BinaryPassManager.cpp
@@ -61,10 +61,9 @@ extern cl::opt<bolt::IdenticalCodeFolding::ICFLevel, false,
                llvm::bolt::DeprecatedICFNumericOptionParser>
     ICF;
 
-static cl::opt<bool>
-DynoStatsAll("dyno-stats-all",
-  cl::desc("print dyno stats after each stage"),
-  cl::ZeroOrMore, cl::Hidden, cl::cat(BoltCategory));
+static cl::opt<bool> DynoStatsAll("dyno-stats-all",
+                                  cl::desc("print dyno stats after each 
stage"),
+                                  cl::Hidden, cl::cat(BoltCategory));
 
 static cl::opt<bool>
     EliminateUnreachable("eliminate-unreachable",
@@ -247,12 +246,13 @@ cl::opt<bool> SimplifyRODataLoads(
              "operand with the constant found in the corresponding section"),
     cl::init(false), cl::cat(BoltOptCategory));
 
-static cl::list<std::string>
-SpecializeMemcpy1("memcpy1-spec",
-  cl::desc("list of functions with call sites for which to specialize memcpy() 
"
-           "for size 1"),
-  cl::value_desc("func1,func2:cs1:cs2,func3:cs1,..."),
-  cl::ZeroOrMore, cl::cat(BoltOptCategory));
+static cl::list<std::string> SpecializeMemcpy1(
+    "memcpy1-spec",
+    cl::desc(
+        "list of functions with call sites for which to specialize memcpy() "
+        "for size 1"),
+    cl::value_desc("func1,func2:cs1:cs2,func3:cs1,..."),
+    cl::cat(BoltOptCategory));
 
 static cl::opt<bool> Stoke("stoke", cl::desc("turn on the stoke analysis"),
                            cl::cat(BoltOptCategory));
diff --git a/bolt/lib/Rewrite/DWARFRewriter.cpp 
b/bolt/lib/Rewrite/DWARFRewriter.cpp
index 0b4598cccf1c3..acb1ba6c8468b 100644
--- a/bolt/lib/Rewrite/DWARFRewriter.cpp
+++ b/bolt/lib/Rewrite/DWARFRewriter.cpp
@@ -378,8 +378,7 @@ static cl::opt<bool>
     DebugSkeletonCu("debug-skeleton-cu",
                     cl::desc("prints out offsets for abbrev and debug_info of "
                              "Skeleton CUs that get patched."),
-                    cl::ZeroOrMore, cl::Hidden, cl::init(false),
-                    cl::cat(BoltCategory));
+                    cl::Hidden, cl::init(false), cl::cat(BoltCategory));
 
 static cl::opt<unsigned> BatchSize(
     "cu-processing-batch-size",
diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp 
b/bolt/lib/Rewrite/RewriteInstance.cpp
index d7078907cf514..845fc4661ac13 100644
--- a/bolt/lib/Rewrite/RewriteInstance.cpp
+++ b/bolt/lib/Rewrite/RewriteInstance.cpp
@@ -193,7 +193,6 @@ LiteThresholdPct("lite-threshold-pct",
             "threshold of 90 means only top 10 percent of functions with "
             "profile will be processed."),
   cl::init(0),
-  cl::ZeroOrMore,
   cl::Hidden,
   cl::cat(BoltOptCategory));
 
@@ -284,7 +283,6 @@ static cl::opt<bool>
 UseGnuStack("use-gnu-stack",
   cl::desc("use GNU_STACK program header for new segment (workaround for "
            "issues with strip/objcopy)"),
-  cl::ZeroOrMore,
   cl::cat(BoltCategory));
 
 static cl::opt<uint64_t> CustomAllocationVMA(
@@ -320,7 +318,7 @@ static cl::list<GadgetKindBitmask> GadgetScannersToRun(
         clEnumValN(GS_PTRAUTH_ALL_MASK, "ptrauth-all",
                    "All Pointer Authentication scanners"),
         clEnumValN(GS_ALL_MASK, "all", "All implemented scanners")),
-    cl::ZeroOrMore, cl::CommaSeparated, cl::cat(BinaryAnalysisCategory));
+    cl::CommaSeparated, cl::cat(BinaryAnalysisCategory));
 
 // Primary targets for hooking runtime library initialization hooking
 // with fallback to next item in case if current item is not available
@@ -342,7 +340,7 @@ cl::opt<RuntimeLibInitHookTarget> RuntimeLibInitHook(
                clEnumValN(RLIH_INIT, "init", "use ELF DT_INIT entry"),
                clEnumValN(RLIH_INIT_ARRAY, "init_array",
                           "use ELF .init_array entry")),
-    cl::ZeroOrMore, cl::cat(BoltOptCategory));
+    cl::cat(BoltOptCategory));
 
 } // namespace opts
 
diff --git a/bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp 
b/bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp
index 2a39aa63554d9..bd4fcd308c254 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 74ca935ee471e..57838e2fe85e7 100644
--- a/bolt/lib/Utils/CommandLineOpts.cpp
+++ b/bolt/lib/Utils/CommandLineOpts.cpp
@@ -57,7 +57,7 @@ cl::opt<bool> AlignBlocks("align-blocks", cl::desc("align 
basic blocks"),
 cl::opt<unsigned> AlignBlocksMinSize(
     "align-blocks-min-size",
     cl::desc("minimal size of the basic block that should be aligned"),
-    cl::init(0), cl::ZeroOrMore, cl::Hidden, cl::cat(BoltOptCategory));
+    cl::init(0), cl::Hidden, cl::cat(BoltOptCategory));
 
 cl::opt<unsigned> AlignBlocksThreshold(
     "align-blocks-threshold",
@@ -76,7 +76,7 @@ cl::opt<unsigned> AlignFunctionsMaxBytes(
 cl::opt<unsigned>
     BlockAlignment("block-alignment",
                    cl::desc("boundary to use for alignment of basic blocks"),
-                   cl::init(16), cl::ZeroOrMore, cl::cat(BoltOptCategory));
+                   cl::init(16), cl::cat(BoltOptCategory));
 
 cl::opt<bool>
     PreserveBlocksAlignment("preserve-blocks-alignment",
@@ -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",
@@ -119,14 +119,13 @@ cl::opt<bool>
 EnableBAT("enable-bat",
   cl::desc("write BOLT Address Translation tables"),
   cl::init(false),
-  cl::ZeroOrMore,
   cl::cat(BoltCategory));
 
 cl::opt<bool> EqualizeBBCounts(
     "equalize-bb-counts",
     cl::desc("use same count for BBs that should have equivalent count (used "
              "in non-LBR and shrink wrapping)"),
-    cl::ZeroOrMore, cl::init(false), cl::Hidden, cl::cat(BoltOptCategory));
+    cl::init(false), cl::Hidden, cl::cat(BoltOptCategory));
 
 llvm::cl::opt<bool> ForcePatch(
     "force-patch",
@@ -142,7 +141,6 @@ ExecutionCountThreshold("execution-count-threshold",
   cl::desc("perform profiling accuracy-sensitive optimizations only if "
            "function execution count >= the threshold (default: 0)"),
   cl::init(0),
-  cl::ZeroOrMore,
   cl::Hidden,
   cl::cat(BoltOptCategory));
 
@@ -238,22 +236,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)"),
@@ -271,7 +269,7 @@ cl::opt<bool> HotText(
         "Generate hot text symbols. Apply this option to a precompiled binary "
         "that manually calls into hugify, such that at runtime hugify call "
         "will put hot code into 2M pages. This requires relocation."),
-    cl::ZeroOrMore, cl::cat(BoltCategory));
+    cl::cat(BoltCategory));
 
 cl::opt<bool> Hugify(
     "hugify",
@@ -297,7 +295,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,
@@ -338,7 +335,7 @@ cl::opt<ProfileFormatKind> ProfileFormat(
                clEnumValN(PF_PreAgg, "preagg", "pre-aggregated profile 
format"),
                clEnumValN(PF_PerfScript, "perfscript",
                           "perfscript profile format")),
-    cl::ZeroOrMore, cl::Hidden, cl::cat(BoltCategory));
+    cl::Hidden, cl::cat(BoltCategory));
 
 cl::list<std::string> ReorderData(
     "reorder-data", cl::CommaSeparated, cl::desc("list of sections to 
reorder"),
@@ -350,7 +347,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));
@@ -381,7 +378,7 @@ cl::opt<bool> UpdateDebugSections(
 
 cl::opt<unsigned>
     Verbosity("v", cl::desc("set verbosity level for diagnostic output"),
-              cl::init(0), cl::ZeroOrMore, cl::cat(BoltCategory),
+              cl::init(0), cl::cat(BoltCategory),
               cl::sub(cl::SubCommand::getAll()));
 
 cl::opt<bool> FixBranchesWithLiveness(
diff --git a/bolt/tools/driver/llvm-bolt.cpp b/bolt/tools/driver/llvm-bolt.cpp
index cc8e6d70001eb..11a31e9e42a02 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 79f0b574f639a..d7cd725665a82 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 8103b72cf4e3a..5a01779613c8c 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 aca0415d7f544..4a481c01f6a68 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/CodeGen/CoverageMappingGen.cpp 
b/clang/lib/CodeGen/CoverageMappingGen.cpp
index b4e6642c592c1..970812f7b0f75 100644
--- a/clang/lib/CodeGen/CoverageMappingGen.cpp
+++ b/clang/lib/CodeGen/CoverageMappingGen.cpp
@@ -34,7 +34,6 @@
 namespace llvm {
 cl::opt<bool>
     EnableSingleByteCoverage("enable-single-byte-coverage",
-                             llvm::cl::ZeroOrMore,
                              llvm::cl::desc("Enable single byte coverage"),
                              llvm::cl::Hidden, llvm::cl::init(false));
 } // namespace llvm
diff --git a/clang/lib/Tooling/CommonOptionsParser.cpp 
b/clang/lib/Tooling/CommonOptionsParser.cpp
index 454e7ca68a65f..14d27b3268600 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 3046e9c5fa371..1e1e8fdbb0503 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 bcb5d2bdb8952..d555ecffee9fb 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 40d77abe2ef7c..380cd53d48bae 100644
--- a/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
+++ b/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
@@ -147,7 +147,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 d011bf30a7c5c..125ee74f8e382 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 264656a838ae8..bd32212d3204f 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 1b88b23abdc1f..cc536549cdd89 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 059a7a5cb0dd6..1c11fbe0f849f 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 d956bd475c9e6..439bf14e30ee5 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 dcf3e5beb8b9c..38146c45edf1d 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 8b608cd75cb12..79bd6899115c2 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 b447b3a30249c..261193cd790ab 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 41ad87d225259..30f30ec57020d 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 9e73048264b0a..ca67084100254 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 39562664e609c..7105e67d37a33 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 ae388474a7925..d9786838aba23 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/AMDGPU/SIRegisterInfo.cpp 
b/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
index 7cad384c98a8d..c91d06d38b389 100644
--- a/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
@@ -35,7 +35,7 @@ static cl::opt<bool> EnableSpillSGPRToVGPR(
 static cl::opt<bool> EnableSpillCFISavedRegs(
     "amdgpu-spill-cfi-saved-regs",
     cl::desc("Enable spilling the registers required for CFI emission"),
-    cl::ReallyHidden, cl::init(false), cl::ZeroOrMore);
+    cl::ReallyHidden, cl::init(false));
 
 static cl::opt<unsigned> StressVGPRLimit(
     "amdgpu-stress-vgpr", cl::Hidden, cl::init(0),
diff --git a/llvm/lib/Target/Hexagon/HexagonGlobalScheduler.cpp 
b/llvm/lib/Target/Hexagon/HexagonGlobalScheduler.cpp
index 30b9b207b539b..6d8fcde73b8c9 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 3726a8e04166c..1a578fd63ffe4 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 469c261ac433e..e01a5c49bfa67 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 39918b6610fce..5eb0118ca8cfa 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 1f50082890898..a377c260a5fa1 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 b1f70442b26af..7df3f9881fe73 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 f32a155c85928..e511dc040d90f 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/IPO/Instrumentor.cpp 
b/llvm/lib/Transforms/IPO/Instrumentor.cpp
index 393e90fdf7d02..c12ff5e69c03d 100644
--- a/llvm/lib/Transforms/IPO/Instrumentor.cpp
+++ b/llvm/lib/Transforms/IPO/Instrumentor.cpp
@@ -82,7 +82,7 @@ static cl::list<std::string>
     ConfigFiles("instrumentor-read-config-files",
                 cl::desc("Read the instrumentor configuration from the "
                          "specified JSON files (comma separated)"),
-                cl::ZeroOrMore, cl::CommaSeparated);
+                cl::CommaSeparated);
 
 /// The user option to specify an input file to read the configuration file
 /// paths from.
diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp 
b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
index 451a60c5b6ecd..3e9b0b3d39c47 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 230977540bf82..4de3941c5860d 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 892d25750004f..abc9a898a52b9 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 05d62b8ec6ff8..861cd84950162 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 2929cd57eea7f..1160167c1cdad 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 0bdb190ca5298..e203afe0f03bd 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 553866f4e9bc4..4ca77cc9e9af1 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 97643c1aa1708..efc2d91bbb064 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 4ead6fd4b88be..7c00469ddae0d 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 42fffeb9c1e45..f06ab494a9d8e 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 879f6c9365cf6..544dec04fab55 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 f0bb8ef35e5e0..e47d8602547c8 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 df6fd9df1294d..e467abea8322c 100644
--- a/polly/lib/CodeGen/LoopGenerators.cpp
+++ b/polly/lib/CodeGen/LoopGenerators.cpp
@@ -38,7 +38,7 @@ static cl::opt<int, true>
 cl::opt<bool> PollyVectorizeMetadata(
     "polly-annotate-metadata-vectorize",
     cl::desc("Append vectorize enable/disable metadata from polly"),
-    cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory));
+    cl::init(false), cl::cat(PollyCategory));
 
 static cl::opt<OMPGeneralSchedulingType, true> XPollyScheduling(
     "polly-scheduling",
@@ -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:
 //
diff --git a/polly/lib/Support/PollyDebug.cpp b/polly/lib/Support/PollyDebug.cpp
index 9dcd8ed03694f..218baf7a70dd4 100644
--- a/polly/lib/Support/PollyDebug.cpp
+++ b/polly/lib/Support/PollyDebug.cpp
@@ -24,4 +24,4 @@ bool polly::getPollyDebugFlag() { return PollyDebugFlag; }
 static cl::opt<bool, true>
     PollyDebug("polly-debug",
                cl::desc("Enable debug output for only polly passes."),
-               cl::Hidden, cl::location(PollyDebugFlag), cl::ZeroOrMore);
+               cl::Hidden, cl::location(PollyDebugFlag));
diff --git a/polly/lib/Transform/MatmulOptimizer.cpp 
b/polly/lib/Transform/MatmulOptimizer.cpp
index 7a6b3d25871c3..2acb7b66298da 100644
--- a/polly/lib/Transform/MatmulOptimizer.cpp
+++ b/polly/lib/Transform/MatmulOptimizer.cpp
@@ -132,19 +132,19 @@ static cl::opt<bool>
     PMBasedTCOpts("polly-tc-opt",
                   cl::desc("Perform optimizations of tensor contractions based 
"
                            "on pattern matching"),
-                  cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory));
+                  cl::init(false), cl::cat(PollyCategory));
 
 static cl::opt<bool>
     PMBasedMMMOpts("polly-matmul-opt",
                    cl::desc("Perform optimizations of matrix multiplications "
                             "based on pattern matching"),
-                   cl::init(true), cl::ZeroOrMore, cl::cat(PollyCategory));
+                   cl::init(true), cl::cat(PollyCategory));
 
 static cl::opt<int> OptComputeOut(
     "polly-tc-dependences-computeout",
     cl::desc("Bound the dependence analysis by a maximal amount of "
              "computational steps (0 means no bound)"),
-    cl::Hidden, cl::init(500000), cl::ZeroOrMore, cl::cat(PollyCategory));
+    cl::Hidden, cl::init(500000), cl::cat(PollyCategory));
 
 namespace {
 /// Parameters of the micro kernel.
diff --git a/polly/lib/Transform/ScheduleOptimizer.cpp 
b/polly/lib/Transform/ScheduleOptimizer.cpp
index b9b9abbd85ae4..68de330729955 100644
--- a/polly/lib/Transform/ScheduleOptimizer.cpp
+++ b/polly/lib/Transform/ScheduleOptimizer.cpp
@@ -101,8 +101,7 @@ static cl::opt<int>
     ScheduleComputeOut("polly-schedule-computeout",
                        cl::desc("Bound the scheduler by maximal amount"
                                 "of computational steps. "),
-                       cl::Hidden, cl::init(300000), cl::ZeroOrMore,
-                       cl::cat(PollyCategory));
+                       cl::Hidden, cl::init(300000), cl::cat(PollyCategory));
 
 static cl::opt<bool>
     GreedyFusion("polly-loopfusion-greedy",

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to