[llvm] 71f4c7d - [NFC]Make file-local cl::opt global variables static (#126486)

via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 2 22:46:37 PST 2025


Author: chrisPyr
Date: 2025-03-03T13:46:33+07:00
New Revision: 71f4c7dabec0f32b2d475e8e08f0da99628a067c

URL: https://github.com/llvm/llvm-project/commit/71f4c7dabec0f32b2d475e8e08f0da99628a067c
DIFF: https://github.com/llvm/llvm-project/commit/71f4c7dabec0f32b2d475e8e08f0da99628a067c.diff

LOG: [NFC]Make file-local cl::opt global variables static (#126486)

#125983

Added: 
    

Modified: 
    llvm/examples/Kaleidoscope/MCJIT/cached/toy.cpp
    llvm/examples/OrcV2Examples/LLJITDumpObjects/LLJITDumpObjects.cpp
    llvm/examples/OrcV2Examples/LLJITWithExecutorProcessControl/LLJITWithExecutorProcessControl.cpp
    llvm/examples/OrcV2Examples/LLJITWithLazyReexports/LLJITWithLazyReexports.cpp
    llvm/examples/OrcV2Examples/LLJITWithThinLTOSummaries/LLJITWithThinLTOSummaries.cpp
    llvm/lib/Analysis/AliasAnalysis.cpp
    llvm/lib/Analysis/BranchProbabilityInfo.cpp
    llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp
    llvm/lib/Analysis/IRSimilarityIdentifier.cpp
    llvm/lib/Analysis/InlineSizeEstimatorAnalysis.cpp
    llvm/lib/Analysis/MemoryProfileInfo.cpp
    llvm/lib/CGData/CodeGenData.cpp
    llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
    llvm/lib/CodeGen/MachinePipeliner.cpp
    llvm/lib/CodeGen/MachineScheduler.cpp
    llvm/lib/CodeGen/WindowScheduler.cpp
    llvm/lib/LTO/LTOCodeGenerator.cpp
    llvm/lib/Target/AArch64/AArch64LowerHomogeneousPrologEpilog.cpp
    llvm/lib/Target/AArch64/AArch64StackTaggingPreRA.cpp
    llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
    llvm/lib/Target/ARM/ARMSelectionDAGInfo.cpp
    llvm/lib/Target/ARM/MVELaneInterleavingPass.cpp
    llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
    llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
    llvm/lib/Transforms/IPO/ElimAvailExtern.cpp
    llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
    llvm/lib/Transforms/IPO/ModuleInliner.cpp
    llvm/lib/Transforms/Scalar/LICM.cpp
    llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
    llvm/lib/Transforms/Vectorize/SandboxVectorizer/SeedCollector.cpp
    llvm/tools/bugpoint/ExecutionDriver.cpp
    llvm/tools/bugpoint/OptimizerDriver.cpp
    llvm/tools/llvm-as/llvm-as.cpp
    llvm/tools/llvm-cat/llvm-cat.cpp
    llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp
    llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp
    llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp
    llvm/tools/llvm-diff/llvm-diff.cpp
    llvm/tools/llvm-extract/llvm-extract.cpp
    llvm/tools/llvm-jitlink/llvm-jitlink.cpp
    llvm/tools/llvm-lto/llvm-lto.cpp
    llvm/tools/llvm-lto2/llvm-lto2.cpp
    llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp
    llvm/tools/llvm-profdata/llvm-profdata.cpp
    llvm/tools/llvm-undname/llvm-undname.cpp
    llvm/tools/reduce-chunk-list/reduce-chunk-list.cpp
    llvm/tools/yaml2obj/yaml2obj.cpp
    llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
    llvm/utils/TableGen/DecoderEmitter.cpp
    llvm/utils/TableGen/GlobalISelEmitter.cpp
    llvm/utils/TableGen/RegisterInfoEmitter.cpp
    llvm/utils/yaml-bench/YAMLBench.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/examples/Kaleidoscope/MCJIT/cached/toy.cpp b/llvm/examples/Kaleidoscope/MCJIT/cached/toy.cpp
index 09cd033f9ab29..b4b7eac8a8831 100644
--- a/llvm/examples/Kaleidoscope/MCJIT/cached/toy.cpp
+++ b/llvm/examples/Kaleidoscope/MCJIT/cached/toy.cpp
@@ -31,15 +31,15 @@ using namespace llvm;
 // Command-line options
 //===----------------------------------------------------------------------===//
 
-cl::opt<std::string>
-InputIR("input-IR",
-        cl::desc("Specify the name of an IR file to load for function definitions"),
-        cl::value_desc("input IR file name"));
-
-cl::opt<bool>
-UseObjectCache("use-object-cache",
-               cl::desc("Enable use of the MCJIT object caching"),
-               cl::init(false));
+static cl::opt<std::string> InputIR(
+    "input-IR",
+    cl::desc("Specify the name of an IR file to load for function definitions"),
+    cl::value_desc("input IR file name"));
+
+static cl::opt<bool>
+    UseObjectCache("use-object-cache",
+                   cl::desc("Enable use of the MCJIT object caching"),
+                   cl::init(false));
 
 //===----------------------------------------------------------------------===//
 // Lexer

diff  --git a/llvm/examples/OrcV2Examples/LLJITDumpObjects/LLJITDumpObjects.cpp b/llvm/examples/OrcV2Examples/LLJITDumpObjects/LLJITDumpObjects.cpp
index c3752cc36c060..264656a838ae8 100644
--- a/llvm/examples/OrcV2Examples/LLJITDumpObjects/LLJITDumpObjects.cpp
+++ b/llvm/examples/OrcV2Examples/LLJITDumpObjects/LLJITDumpObjects.cpp
@@ -21,17 +21,17 @@ using namespace llvm::orc;
 
 ExitOnError ExitOnErr;
 
-cl::opt<bool> DumpJITdObjects("dump-jitted-objects",
-                              cl::desc("dump jitted objects"), cl::Optional,
-                              cl::init(true));
+static cl::opt<bool> DumpJITdObjects("dump-jitted-objects",
+                                     cl::desc("dump jitted objects"),
+                                     cl::Optional, cl::init(true));
 
-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::Optional, cl::init(""));
 
-cl::opt<std::string> DumpFileStem("dump-file-stem",
-                                  cl::desc("Override default dump names"),
-                                  cl::Optional, cl::init(""));
+static cl::opt<std::string>
+    DumpFileStem("dump-file-stem", cl::desc("Override default dump names"),
+                 cl::Optional, cl::init(""));
 
 int main(int argc, char *argv[]) {
   // Initialize LLVM.

diff  --git a/llvm/examples/OrcV2Examples/LLJITWithExecutorProcessControl/LLJITWithExecutorProcessControl.cpp b/llvm/examples/OrcV2Examples/LLJITWithExecutorProcessControl/LLJITWithExecutorProcessControl.cpp
index a219cab6e2f77..043150f47d926 100644
--- a/llvm/examples/OrcV2Examples/LLJITWithExecutorProcessControl/LLJITWithExecutorProcessControl.cpp
+++ b/llvm/examples/OrcV2Examples/LLJITWithExecutorProcessControl/LLJITWithExecutorProcessControl.cpp
@@ -117,8 +117,8 @@ static void reportErrorAndExit() {
   exit(1);
 }
 
-cl::list<std::string> InputArgv(cl::Positional,
-                                cl::desc("<program arguments>..."));
+static cl::list<std::string> InputArgv(cl::Positional,
+                                       cl::desc("<program arguments>..."));
 
 int main(int argc, char *argv[]) {
   // Initialize LLVM.

diff  --git a/llvm/examples/OrcV2Examples/LLJITWithLazyReexports/LLJITWithLazyReexports.cpp b/llvm/examples/OrcV2Examples/LLJITWithLazyReexports/LLJITWithLazyReexports.cpp
index 4b987cdd37cc5..dc1edb16a560c 100644
--- a/llvm/examples/OrcV2Examples/LLJITWithLazyReexports/LLJITWithLazyReexports.cpp
+++ b/llvm/examples/OrcV2Examples/LLJITWithLazyReexports/LLJITWithLazyReexports.cpp
@@ -86,8 +86,8 @@ const llvm::StringRef MainMod =
   declare i32 @bar()
 )";
 
-cl::list<std::string> InputArgv(cl::Positional,
-                                cl::desc("<program arguments>..."));
+static cl::list<std::string> InputArgv(cl::Positional,
+                                       cl::desc("<program arguments>..."));
 
 int main(int argc, char *argv[]) {
   // Initialize LLVM.

diff  --git a/llvm/examples/OrcV2Examples/LLJITWithThinLTOSummaries/LLJITWithThinLTOSummaries.cpp b/llvm/examples/OrcV2Examples/LLJITWithThinLTOSummaries/LLJITWithThinLTOSummaries.cpp
index a7cb4fce94909..f498a97442c44 100644
--- a/llvm/examples/OrcV2Examples/LLJITWithThinLTOSummaries/LLJITWithThinLTOSummaries.cpp
+++ b/llvm/examples/OrcV2Examples/LLJITWithThinLTOSummaries/LLJITWithThinLTOSummaries.cpp
@@ -55,8 +55,8 @@ using namespace llvm;
 using namespace llvm::orc;
 
 // Path of the module summary index file.
-cl::opt<std::string> IndexFile{cl::desc("<module summary index>"),
-                               cl::Positional, cl::init("-")};
+static cl::opt<std::string> IndexFile{cl::desc("<module summary index>"),
+                                      cl::Positional, cl::init("-")};
 
 // Describe a fail state that is caused by the given ModuleSummaryIndex
 // providing multiple definitions of the given global value name. It will dump

diff  --git a/llvm/lib/Analysis/AliasAnalysis.cpp b/llvm/lib/Analysis/AliasAnalysis.cpp
index 3365349922078..c3d2ad1aaceca 100644
--- a/llvm/lib/Analysis/AliasAnalysis.cpp
+++ b/llvm/lib/Analysis/AliasAnalysis.cpp
@@ -58,11 +58,10 @@ STATISTIC(NumNoAlias,   "Number of NoAlias results");
 STATISTIC(NumMayAlias,  "Number of MayAlias results");
 STATISTIC(NumMustAlias, "Number of MustAlias results");
 
-namespace llvm {
 /// Allow disabling BasicAA from the AA results. This is particularly useful
 /// when testing to isolate a single AA implementation.
-cl::opt<bool> DisableBasicAA("disable-basic-aa", cl::Hidden, cl::init(false));
-} // namespace llvm
+static cl::opt<bool> DisableBasicAA("disable-basic-aa", cl::Hidden,
+                                    cl::init(false));
 
 #ifndef NDEBUG
 /// Print a trace of alias analysis queries and their results.

diff  --git a/llvm/lib/Analysis/BranchProbabilityInfo.cpp b/llvm/lib/Analysis/BranchProbabilityInfo.cpp
index 8077c28f79a39..62c2b361f1b81 100644
--- a/llvm/lib/Analysis/BranchProbabilityInfo.cpp
+++ b/llvm/lib/Analysis/BranchProbabilityInfo.cpp
@@ -54,7 +54,7 @@ static cl::opt<bool> PrintBranchProb(
     "print-bpi", cl::init(false), cl::Hidden,
     cl::desc("Print the branch probability info."));
 
-cl::opt<std::string> PrintBranchProbFuncName(
+static cl::opt<std::string> PrintBranchProbFuncName(
     "print-bpi-func-name", cl::Hidden,
     cl::desc("The option to specify the name of the function "
              "whose branch probability info is printed."));

diff  --git a/llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp b/llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp
index 0ffbc90d7ee22..c135fe12dc37e 100644
--- a/llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp
+++ b/llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp
@@ -30,12 +30,12 @@ cl::opt<bool> EnableDetailedFunctionProperties(
     "enable-detailed-function-properties", cl::Hidden, cl::init(false),
     cl::desc("Whether or not to compute detailed function properties."));
 
-cl::opt<unsigned> BigBasicBlockInstructionThreshold(
+static cl::opt<unsigned> BigBasicBlockInstructionThreshold(
     "big-basic-block-instruction-threshold", cl::Hidden, cl::init(500),
     cl::desc("The minimum number of instructions a basic block should contain "
              "before being considered big."));
 
-cl::opt<unsigned> MediumBasicBlockInstructionThreshold(
+static cl::opt<unsigned> MediumBasicBlockInstructionThreshold(
     "medium-basic-block-instruction-threshold", cl::Hidden, cl::init(15),
     cl::desc("The minimum number of instructions a basic block should contain "
              "before being considered medium-sized."));

diff  --git a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
index 42e986e6179dd..e1daf02ee6bba 100644
--- a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
+++ b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
@@ -36,7 +36,7 @@ cl::opt<bool>
                          cl::ReallyHidden,
                          cl::desc("disable outlining indirect calls."));
 
-cl::opt<bool>
+static cl::opt<bool>
     MatchCallsByName("ir-sim-calls-by-name", cl::init(false), cl::ReallyHidden,
                      cl::desc("only allow matching call instructions if the "
                               "name and type signature match."));

diff  --git a/llvm/lib/Analysis/InlineSizeEstimatorAnalysis.cpp b/llvm/lib/Analysis/InlineSizeEstimatorAnalysis.cpp
index 4074b678d0259..fcecfc795b571 100644
--- a/llvm/lib/Analysis/InlineSizeEstimatorAnalysis.cpp
+++ b/llvm/lib/Analysis/InlineSizeEstimatorAnalysis.cpp
@@ -36,7 +36,7 @@ AnalysisKey InlineSizeEstimatorAnalysis::Key;
 #include <deque>
 #include <optional>
 
-cl::opt<std::string> TFIR2NativeModelPath(
+static cl::opt<std::string> TFIR2NativeModelPath(
     "ml-inliner-ir2native-model", cl::Hidden,
     cl::desc("Path to saved model evaluating native size from IR."));
 

diff  --git a/llvm/lib/Analysis/MemoryProfileInfo.cpp b/llvm/lib/Analysis/MemoryProfileInfo.cpp
index 913396f9ef5a2..95138de592290 100644
--- a/llvm/lib/Analysis/MemoryProfileInfo.cpp
+++ b/llvm/lib/Analysis/MemoryProfileInfo.cpp
@@ -54,7 +54,7 @@ cl::opt<bool> MemProfReportHintedSizes(
 // This is useful if we have enabled reporting of hinted sizes, and want to get
 // information from the indexing step for all contexts (especially for testing),
 // or have specified a value less than 100% for -memprof-cloning-cold-threshold.
-cl::opt<bool> MemProfKeepAllNotColdContexts(
+static cl::opt<bool> MemProfKeepAllNotColdContexts(
     "memprof-keep-all-not-cold-contexts", cl::init(false), cl::Hidden,
     cl::desc("Keep all non-cold contexts (increases cloning overheads)"));
 

diff  --git a/llvm/lib/CGData/CodeGenData.cpp b/llvm/lib/CGData/CodeGenData.cpp
index bb6b9c7721d55..02de528c4d007 100644
--- a/llvm/lib/CGData/CodeGenData.cpp
+++ b/llvm/lib/CGData/CodeGenData.cpp
@@ -27,10 +27,10 @@
 using namespace llvm;
 using namespace cgdata;
 
-cl::opt<bool>
+static cl::opt<bool>
     CodeGenDataGenerate("codegen-data-generate", cl::init(false), cl::Hidden,
                         cl::desc("Emit CodeGen Data into custom sections"));
-cl::opt<std::string>
+static cl::opt<std::string>
     CodeGenDataUsePath("codegen-data-use-path", cl::init(""), cl::Hidden,
                        cl::desc("File path to where .cgdata file is read"));
 cl::opt<bool> CodeGenDataThinLTOTwoRounds(

diff  --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index 5bc30fede4720..dad14b98d2c3d 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -44,7 +44,7 @@
 using namespace llvm;
 
 /// Query value using AddLinkageNamesToDeclCallOriginsForTuning.
-cl::opt<cl::boolOrDefault> AddLinkageNamesToDeclCallOrigins(
+static cl::opt<cl::boolOrDefault> AddLinkageNamesToDeclCallOrigins(
     "add-linkage-names-to-declaration-call-origins", cl::Hidden,
     cl::desc("Add DW_AT_linkage_name to function declaration DIEs "
              "referenced by DW_AT_call_origin attributes. Enabled by default "

diff  --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp
index 064b0a0f11747..a34b204fed6dc 100644
--- a/llvm/lib/CodeGen/MachinePipeliner.cpp
+++ b/llvm/lib/CodeGen/MachinePipeliner.cpp
@@ -209,7 +209,7 @@ cl::opt<int> SwpForceIssueWidth(
     cl::init(-1));
 
 /// A command line argument to set the window scheduling option.
-cl::opt<WindowSchedulingFlag> WindowSchedulingOption(
+static cl::opt<WindowSchedulingFlag> WindowSchedulingOption(
     "window-sched", cl::Hidden, cl::init(WindowSchedulingFlag::WS_On),
     cl::desc("Set how to use window scheduling algorithm."),
     cl::values(clEnumValN(WindowSchedulingFlag::WS_Off, "off",

diff  --git a/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp
index d67e4ef572469..4ee8e12bf276c 100644
--- a/llvm/lib/CodeGen/MachineScheduler.cpp
+++ b/llvm/lib/CodeGen/MachineScheduler.cpp
@@ -90,7 +90,7 @@ cl::opt<MISched::Direction> PreRADirection(
         clEnumValN(MISched::Bidirectional, "bidirectional",
                    "Force bidirectional pre reg-alloc list scheduling")));
 
-cl::opt<MISched::Direction> PostRADirection(
+static cl::opt<MISched::Direction> PostRADirection(
     "misched-postra-direction", cl::Hidden,
     cl::desc("Post reg-alloc list scheduling direction"),
     cl::init(MISched::Unspecified),
@@ -102,9 +102,9 @@ cl::opt<MISched::Direction> PostRADirection(
         clEnumValN(MISched::Bidirectional, "bidirectional",
                    "Force bidirectional post reg-alloc list scheduling")));
 
-cl::opt<bool>
-DumpCriticalPathLength("misched-dcpl", cl::Hidden,
-                       cl::desc("Print critical path length to stdout"));
+static cl::opt<bool>
+    DumpCriticalPathLength("misched-dcpl", cl::Hidden,
+                           cl::desc("Print critical path length to stdout"));
 
 cl::opt<bool> VerifyScheduling(
     "verify-misched", cl::Hidden,

diff  --git a/llvm/lib/CodeGen/WindowScheduler.cpp b/llvm/lib/CodeGen/WindowScheduler.cpp
index 379740cae78d5..78af6314e7b2d 100644
--- a/llvm/lib/CodeGen/WindowScheduler.cpp
+++ b/llvm/lib/CodeGen/WindowScheduler.cpp
@@ -96,7 +96,7 @@ cl::opt<unsigned> WindowDiffLimit(
 
 // WindowIILimit serves as an indicator of abnormal scheduling results and could
 // potentially be referenced by the derived target window scheduler.
-cl::opt<unsigned>
+static cl::opt<unsigned>
     WindowIILimit("window-ii-limit",
                   cl::desc("The upper limit of II in the window algorithm."),
                   cl::Hidden, cl::init(1000));

diff  --git a/llvm/lib/LTO/LTOCodeGenerator.cpp b/llvm/lib/LTO/LTOCodeGenerator.cpp
index a192392e04585..774e63899f64b 100644
--- a/llvm/lib/LTO/LTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/LTOCodeGenerator.cpp
@@ -109,21 +109,20 @@ cl::opt<std::string> RemarksFormat(
     cl::desc("The format used for serializing remarks (default: YAML)"),
     cl::value_desc("format"), cl::init("yaml"));
 
-cl::opt<std::string> LTOStatsFile(
-    "lto-stats-file",
-    cl::desc("Save statistics to the specified file"),
-    cl::Hidden);
+static cl::opt<std::string>
+    LTOStatsFile("lto-stats-file",
+                 cl::desc("Save statistics to the specified file"), cl::Hidden);
 
-cl::opt<std::string> AIXSystemAssemblerPath(
+static cl::opt<std::string> AIXSystemAssemblerPath(
     "lto-aix-system-assembler",
     cl::desc("Path to a system assembler, picked up on AIX only"),
     cl::value_desc("path"));
 
-cl::opt<bool>
+static cl::opt<bool>
     LTORunCSIRInstr("cs-profile-generate",
                     cl::desc("Perform context sensitive PGO instrumentation"));
 
-cl::opt<std::string>
+static cl::opt<std::string>
     LTOCSIRProfile("cs-profile-path",
                    cl::desc("Context sensitive profile file path"));
 } // namespace llvm

diff  --git a/llvm/lib/Target/AArch64/AArch64LowerHomogeneousPrologEpilog.cpp b/llvm/lib/Target/AArch64/AArch64LowerHomogeneousPrologEpilog.cpp
index ed531038395c4..b5911ac09cc18 100644
--- a/llvm/lib/Target/AArch64/AArch64LowerHomogeneousPrologEpilog.cpp
+++ b/llvm/lib/Target/AArch64/AArch64LowerHomogeneousPrologEpilog.cpp
@@ -32,7 +32,7 @@ using namespace llvm;
 #define AARCH64_LOWER_HOMOGENEOUS_PROLOG_EPILOG_NAME                           \
   "AArch64 homogeneous prolog/epilog lowering pass"
 
-cl::opt<int> FrameHelperSizeThreshold(
+static cl::opt<int> FrameHelperSizeThreshold(
     "frame-helper-size-threshold", cl::init(2), cl::Hidden,
     cl::desc("The minimum number of instructions that are outlined in a frame "
              "helper (default = 2)"));

diff  --git a/llvm/lib/Target/AArch64/AArch64StackTaggingPreRA.cpp b/llvm/lib/Target/AArch64/AArch64StackTaggingPreRA.cpp
index 51bf4b8c30044..558f20848babd 100644
--- a/llvm/lib/Target/AArch64/AArch64StackTaggingPreRA.cpp
+++ b/llvm/lib/Target/AArch64/AArch64StackTaggingPreRA.cpp
@@ -31,9 +31,8 @@ using namespace llvm;
 
 enum UncheckedLdStMode { UncheckedNever, UncheckedSafe, UncheckedAlways };
 
-cl::opt<UncheckedLdStMode> ClUncheckedLdSt(
-    "stack-tagging-unchecked-ld-st", cl::Hidden,
-    cl::init(UncheckedSafe),
+static cl::opt<UncheckedLdStMode> ClUncheckedLdSt(
+    "stack-tagging-unchecked-ld-st", cl::Hidden, cl::init(UncheckedSafe),
     cl::desc(
         "Unconditionally apply unchecked-ld-st optimization (even for large "
         "stack frames, or in the presence of variable sized allocas)."),

diff  --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
index 1008be32e5bfa..65cd64a85150a 100644
--- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
+++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
@@ -185,7 +185,7 @@ class TailFoldingOption {
 
 TailFoldingOption TailFoldingOptionLoc;
 
-cl::opt<TailFoldingOption, true, cl::parser<std::string>> SVETailFolding(
+static cl::opt<TailFoldingOption, true, cl::parser<std::string>> SVETailFolding(
     "sve-tail-folding",
     cl::desc(
         "Control the use of vectorisation using tail-folding for SVE where the"

diff  --git a/llvm/lib/Target/ARM/ARMSelectionDAGInfo.cpp b/llvm/lib/Target/ARM/ARMSelectionDAGInfo.cpp
index a39487c318f8e..77f4782699c96 100644
--- a/llvm/lib/Target/ARM/ARMSelectionDAGInfo.cpp
+++ b/llvm/lib/Target/ARM/ARMSelectionDAGInfo.cpp
@@ -17,7 +17,7 @@ using namespace llvm;
 
 #define DEBUG_TYPE "arm-selectiondag-info"
 
-cl::opt<TPLoop::MemTransfer> EnableMemtransferTPLoop(
+static cl::opt<TPLoop::MemTransfer> EnableMemtransferTPLoop(
     "arm-memtransfer-tploop", cl::Hidden,
     cl::desc("Control conversion of memcpy to "
              "Tail predicated loops (WLSTP)"),

diff  --git a/llvm/lib/Target/ARM/MVELaneInterleavingPass.cpp b/llvm/lib/Target/ARM/MVELaneInterleavingPass.cpp
index 36269caa835a2..e6bb4986c836e 100644
--- a/llvm/lib/Target/ARM/MVELaneInterleavingPass.cpp
+++ b/llvm/lib/Target/ARM/MVELaneInterleavingPass.cpp
@@ -70,7 +70,7 @@ using namespace llvm;
 
 #define DEBUG_TYPE "mve-laneinterleave"
 
-cl::opt<bool> EnableInterleave(
+static cl::opt<bool> EnableInterleave(
     "enable-mve-interleave", cl::Hidden, cl::init(true),
     cl::desc("Enable interleave MVE vector operation lowering"));
 

diff  --git a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
index 3b331b06e6a3a..80e5c10691393 100644
--- a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
+++ b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
@@ -97,7 +97,7 @@ cl::opt<bool> MV79("mv79", cl::Hidden, cl::desc("Build for Hexagon V79"),
                    cl::init(false));
 } // namespace
 
-cl::opt<Hexagon::ArchEnum> EnableHVX(
+static cl::opt<Hexagon::ArchEnum> EnableHVX(
     "mhvx", cl::desc("Enable Hexagon Vector eXtensions"),
     cl::values(clEnumValN(Hexagon::ArchEnum::V60, "v60", "Build for HVX v60"),
                clEnumValN(Hexagon::ArchEnum::V62, "v62", "Build for HVX v62"),

diff  --git a/llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
index eed0b42863ee6..d78e755643fb4 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
@@ -34,7 +34,7 @@ using namespace llvm;
 
 // This disables the removal of registers when lowering into MC, as required
 // by some current tests.
-cl::opt<bool>
+static cl::opt<bool>
     WasmKeepRegisters("wasm-keep-registers", cl::Hidden,
                       cl::desc("WebAssembly: output stack registers in"
                                " instruction output for test purposes only."),

diff  --git a/llvm/lib/Transforms/IPO/ElimAvailExtern.cpp b/llvm/lib/Transforms/IPO/ElimAvailExtern.cpp
index afd5e3ac15ac1..ffdd1e4747c27 100644
--- a/llvm/lib/Transforms/IPO/ElimAvailExtern.cpp
+++ b/llvm/lib/Transforms/IPO/ElimAvailExtern.cpp
@@ -30,7 +30,7 @@ using namespace llvm;
 
 #define DEBUG_TYPE "elim-avail-extern"
 
-cl::opt<bool> ConvertToLocal(
+static cl::opt<bool> ConvertToLocal(
     "avail-extern-to-local", cl::Hidden,
     cl::desc("Convert available_externally into locals, renaming them "
              "to avoid link-time clashes."));

diff  --git a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
index d014cc35ec8b3..dee2a1b676cd8 100644
--- a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
+++ b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
@@ -180,7 +180,7 @@ cl::opt<bool> SupportsHotColdNew(
     "supports-hot-cold-new", cl::init(false), cl::Hidden,
     cl::desc("Linking with hot/cold operator new interfaces"));
 
-cl::opt<bool> MemProfRequireDefinitionForPromotion(
+static cl::opt<bool> MemProfRequireDefinitionForPromotion(
     "memprof-require-definition-for-promotion", cl::init(false), cl::Hidden,
     cl::desc(
         "Require target function definition when promoting indirect calls"));

diff  --git a/llvm/lib/Transforms/IPO/ModuleInliner.cpp b/llvm/lib/Transforms/IPO/ModuleInliner.cpp
index dbc733826944b..5dbbd73a4c5dc 100644
--- a/llvm/lib/Transforms/IPO/ModuleInliner.cpp
+++ b/llvm/lib/Transforms/IPO/ModuleInliner.cpp
@@ -49,7 +49,7 @@ using namespace llvm;
 STATISTIC(NumInlined, "Number of functions inlined");
 STATISTIC(NumDeleted, "Number of functions deleted because all callers found");
 
-cl::opt<bool> CtxProfPromoteAlwaysInline(
+static cl::opt<bool> CtxProfPromoteAlwaysInline(
     "ctx-prof-promote-alwaysinline", cl::init(false), cl::Hidden,
     cl::desc("If using a contextual profile in this module, and an indirect "
              "call target is marked as alwaysinline, perform indirect call "

diff  --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index 7f2554409bc6a..0ccbe6ec144c9 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -140,7 +140,7 @@ static cl::opt<unsigned> FPAssociationUpperLimit(
         "Set upper limit for the number of transformations performed "
         "during a single round of hoisting the reassociated expressions."));
 
-cl::opt<unsigned> IntAssociationUpperLimit(
+static cl::opt<unsigned> IntAssociationUpperLimit(
     "licm-max-num-int-reassociations", cl::init(5U), cl::Hidden,
     cl::desc(
         "Set upper limit for the number of transformations performed "

diff  --git a/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
index 370af0eaedf99..3ec6850d6f685 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
@@ -43,12 +43,10 @@ AllowStridedPointerIVs("lv-strided-pointer-ivs", cl::init(false), cl::Hidden,
                        cl::desc("Enable recognition of non-constant strided "
                                 "pointer induction variables."));
 
-namespace llvm {
-cl::opt<bool>
+static cl::opt<bool>
     HintsAllowReordering("hints-allow-reordering", cl::init(true), cl::Hidden,
                          cl::desc("Allow enabling loop hints to reorder "
                                   "FP operations during vectorization."));
-} // namespace llvm
 
 // TODO: Move size-based thresholds out of legality checking, make cost based
 // decisions instead of hard thresholds.

diff  --git a/llvm/lib/Transforms/Vectorize/SandboxVectorizer/SeedCollector.cpp b/llvm/lib/Transforms/Vectorize/SandboxVectorizer/SeedCollector.cpp
index bc86c785e84ae..923a35e60c309 100644
--- a/llvm/lib/Transforms/Vectorize/SandboxVectorizer/SeedCollector.cpp
+++ b/llvm/lib/Transforms/Vectorize/SandboxVectorizer/SeedCollector.cpp
@@ -17,16 +17,16 @@
 using namespace llvm;
 namespace llvm::sandboxir {
 
-cl::opt<unsigned> SeedBundleSizeLimit(
+static cl::opt<unsigned> SeedBundleSizeLimit(
     "sbvec-seed-bundle-size-limit", cl::init(32), cl::Hidden,
     cl::desc("Limit the size of the seed bundle to cap compilation time."));
 #define LoadSeedsDef "loads"
 #define StoreSeedsDef "stores"
-cl::opt<std::string> CollectSeeds(
+static cl::opt<std::string> CollectSeeds(
     "sbvec-collect-seeds", cl::init(LoadSeedsDef "," StoreSeedsDef), cl::Hidden,
     cl::desc("Collect these seeds. Use empty for none or a comma-separated "
              "list of '" LoadSeedsDef "' and '" StoreSeedsDef "'."));
-cl::opt<unsigned> SeedGroupsLimit(
+static cl::opt<unsigned> SeedGroupsLimit(
     "sbvec-seed-groups-limit", cl::init(256), cl::Hidden,
     cl::desc("Limit the number of collected seeds groups in a BB to "
              "cap compilation time."));

diff  --git a/llvm/tools/bugpoint/ExecutionDriver.cpp b/llvm/tools/bugpoint/ExecutionDriver.cpp
index 18187ad97dddd..165b55f1ac54e 100644
--- a/llvm/tools/bugpoint/ExecutionDriver.cpp
+++ b/llvm/tools/bugpoint/ExecutionDriver.cpp
@@ -82,11 +82,11 @@ cl::opt<std::string>
     InputFile("input", cl::init("/dev/null"),
               cl::desc("Filename to pipe in as stdin (default: /dev/null)"));
 
-cl::list<std::string>
+static cl::list<std::string>
     AdditionalSOs("additional-so", cl::desc("Additional shared objects to load "
                                             "into executing programs"));
 
-cl::list<std::string> AdditionalLinkerArgs(
+static cl::list<std::string> AdditionalLinkerArgs(
     "Xlinker", cl::desc("Additional arguments to pass to the linker"));
 
 cl::opt<std::string> CustomCompileCommand(

diff  --git a/llvm/tools/bugpoint/OptimizerDriver.cpp b/llvm/tools/bugpoint/OptimizerDriver.cpp
index ce324594724ca..0b29a1f17d879 100644
--- a/llvm/tools/bugpoint/OptimizerDriver.cpp
+++ b/llvm/tools/bugpoint/OptimizerDriver.cpp
@@ -111,7 +111,7 @@ void BugDriver::EmitProgressBitcode(const Module &M, const std::string &ID,
   outs() << " " << getPassesString(PassesToRun) << "\n";
 }
 
-cl::opt<bool> SilencePasses(
+static cl::opt<bool> SilencePasses(
     "silence-passes",
     cl::desc("Suppress output of running passes (both stdout and stderr)"));
 

diff  --git a/llvm/tools/llvm-as/llvm-as.cpp b/llvm/tools/llvm-as/llvm-as.cpp
index d8e36de59bcb4..1c29a7b671c46 100644
--- a/llvm/tools/llvm-as/llvm-as.cpp
+++ b/llvm/tools/llvm-as/llvm-as.cpp
@@ -30,7 +30,7 @@
 #include <optional>
 using namespace llvm;
 
-cl::OptionCategory AsCat("llvm-as Options");
+static cl::OptionCategory AsCat("llvm-as Options");
 
 static cl::opt<std::string>
     InputFilename(cl::Positional, cl::desc("<input .ll file>"), cl::init("-"));

diff  --git a/llvm/tools/llvm-cat/llvm-cat.cpp b/llvm/tools/llvm-cat/llvm-cat.cpp
index f19f66d562165..b6d6a80bcc2a1 100644
--- a/llvm/tools/llvm-cat/llvm-cat.cpp
+++ b/llvm/tools/llvm-cat/llvm-cat.cpp
@@ -32,7 +32,7 @@
 
 using namespace llvm;
 
-cl::OptionCategory CatCategory("llvm-cat Options");
+static cl::OptionCategory CatCategory("llvm-cat Options");
 
 static cl::opt<bool>
     BinaryCat("b", cl::desc("Whether to perform binary concatenation"),

diff  --git a/llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp b/llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp
index 8a9d9ce41837a..0f2c7da94230e 100644
--- a/llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp
+++ b/llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp
@@ -35,23 +35,25 @@ using namespace llvm::cfi_verify;
 
 static cl::OptionCategory CFIVerifyCategory("CFI Verify Options");
 
-cl::opt<std::string> InputFilename(cl::Positional, cl::desc("<input file>"),
-                                   cl::Required, cl::cat(CFIVerifyCategory));
-cl::opt<std::string> IgnorelistFilename(cl::Positional,
-                                        cl::desc("[ignorelist file]"),
-                                        cl::init("-"),
-                                        cl::cat(CFIVerifyCategory));
-cl::opt<bool> PrintGraphs(
+static cl::opt<std::string> InputFilename(cl::Positional,
+                                          cl::desc("<input file>"),
+                                          cl::Required,
+                                          cl::cat(CFIVerifyCategory));
+static cl::opt<std::string> IgnorelistFilename(cl::Positional,
+                                               cl::desc("[ignorelist file]"),
+                                               cl::init("-"),
+                                               cl::cat(CFIVerifyCategory));
+static cl::opt<bool> PrintGraphs(
     "print-graphs",
     cl::desc("Print graphs around indirect CF instructions in DOT format."),
     cl::init(false), cl::cat(CFIVerifyCategory));
-cl::opt<unsigned> PrintBlameContext(
+static cl::opt<unsigned> PrintBlameContext(
     "blame-context",
     cl::desc("Print the blame context (if possible) for BAD instructions. This "
              "specifies the number of lines of context to include, where zero "
              "disables this feature."),
     cl::init(0), cl::cat(CFIVerifyCategory));
-cl::opt<unsigned> PrintBlameContextAll(
+static cl::opt<unsigned> PrintBlameContextAll(
     "blame-context-all",
     cl::desc("Prints the blame context (if possible) for ALL instructions. "
              "This specifies the number of lines of context for non-BAD "
@@ -59,8 +61,8 @@ cl::opt<unsigned> PrintBlameContextAll(
              "unspecified, it prints this number of contextual lines for BAD "
              "instructions as well."),
     cl::init(0), cl::cat(CFIVerifyCategory));
-cl::opt<bool> Summarize("summarize", cl::desc("Print the summary only."),
-                        cl::init(false), cl::cat(CFIVerifyCategory));
+static cl::opt<bool> Summarize("summarize", cl::desc("Print the summary only."),
+                               cl::init(false), cl::cat(CFIVerifyCategory));
 
 ExitOnError ExitOnErr;
 

diff  --git a/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp b/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp
index c04aec19174b8..2022444931b86 100644
--- a/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp
+++ b/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp
@@ -33,7 +33,7 @@ using namespace llvm::object;
 using namespace llvm::support;
 
 namespace opts {
-cl::OptionCategory CXXDumpCategory("CXX Dump Options");
+static cl::OptionCategory CXXDumpCategory("CXX Dump Options");
 cl::list<std::string> InputFilenames(cl::Positional,
                                      cl::desc("<input object files>"),
                                      cl::cat(CXXDumpCategory));

diff  --git a/llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp b/llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp
index c5ccd64f11653..6eb193ad5f45c 100644
--- a/llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp
+++ b/llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp
@@ -25,30 +25,31 @@
 
 using namespace llvm;
 
-cl::OptionCategory CXXMapCategory("CXX Map Options");
-
-cl::opt<std::string> OldSymbolFile(cl::Positional, cl::Required,
-                                   cl::desc("<symbol-file>"),
-                                   cl::cat(CXXMapCategory));
-cl::opt<std::string> NewSymbolFile(cl::Positional, cl::Required,
-                                   cl::desc("<symbol-file>"),
-                                   cl::cat(CXXMapCategory));
-cl::opt<std::string> RemappingFile("remapping-file", cl::Required,
-                                   cl::desc("Remapping file"),
-                                   cl::cat(CXXMapCategory));
-cl::alias RemappingFileA("r", cl::aliasopt(RemappingFile),
-                         cl::cat(CXXMapCategory));
-cl::opt<std::string> OutputFilename("output", cl::value_desc("output"),
-                                    cl::init("-"), cl::desc("Output file"),
-                                    cl::cat(CXXMapCategory));
-cl::alias OutputFilenameA("o", cl::aliasopt(OutputFilename),
-                          cl::cat(CXXMapCategory));
-
-cl::opt<bool> WarnAmbiguous(
+static cl::OptionCategory CXXMapCategory("CXX Map Options");
+
+static cl::opt<std::string> OldSymbolFile(cl::Positional, cl::Required,
+                                          cl::desc("<symbol-file>"),
+                                          cl::cat(CXXMapCategory));
+static cl::opt<std::string> NewSymbolFile(cl::Positional, cl::Required,
+                                          cl::desc("<symbol-file>"),
+                                          cl::cat(CXXMapCategory));
+static cl::opt<std::string> RemappingFile("remapping-file", cl::Required,
+                                          cl::desc("Remapping file"),
+                                          cl::cat(CXXMapCategory));
+static cl::alias RemappingFileA("r", cl::aliasopt(RemappingFile),
+                                cl::cat(CXXMapCategory));
+static cl::opt<std::string> OutputFilename("output", cl::value_desc("output"),
+                                           cl::init("-"),
+                                           cl::desc("Output file"),
+                                           cl::cat(CXXMapCategory));
+static cl::alias OutputFilenameA("o", cl::aliasopt(OutputFilename),
+                                 cl::cat(CXXMapCategory));
+
+static cl::opt<bool> WarnAmbiguous(
     "Wambiguous",
     cl::desc("Warn on equivalent symbols in the output symbol list"),
     cl::cat(CXXMapCategory));
-cl::opt<bool> WarnIncomplete(
+static cl::opt<bool> WarnIncomplete(
     "Wincomplete",
     cl::desc("Warn on input symbols missing from output symbol list"),
     cl::cat(CXXMapCategory));

diff  --git a/llvm/tools/llvm-
diff /llvm-
diff .cpp b/llvm/tools/llvm-
diff /llvm-
diff .cpp
index 3e77b1ed89b04..2126b91f75ae1 100644
--- a/llvm/tools/llvm-
diff /llvm-
diff .cpp
+++ b/llvm/tools/llvm-
diff /llvm-
diff .cpp
@@ -56,7 +56,7 @@ static void 
diff Global(DifferenceEngine &Engine, Module &L, Module &R,
     errs() << "No function named @" << Name << " in right module\n";
 }
 
-cl::OptionCategory DiffCategory("Diff Options");
+static cl::OptionCategory DiffCategory("Diff Options");
 
 static cl::opt<std::string> LeftFilename(cl::Positional,
                                          cl::desc("<first file>"), cl::Required,

diff  --git a/llvm/tools/llvm-extract/llvm-extract.cpp b/llvm/tools/llvm-extract/llvm-extract.cpp
index 5fc9a31ab4ad7..9641178c78069 100644
--- a/llvm/tools/llvm-extract/llvm-extract.cpp
+++ b/llvm/tools/llvm-extract/llvm-extract.cpp
@@ -41,7 +41,7 @@
 
 using namespace llvm;
 
-cl::OptionCategory ExtractCat("llvm-extract Options");
+static cl::OptionCategory ExtractCat("llvm-extract Options");
 
 // InputFilename - The filename to read from.
 static cl::opt<std::string> InputFilename(cl::Positional,

diff  --git a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
index 85cf3a0195964..e4ed5b2aefb9a 100644
--- a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
+++ b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
@@ -97,7 +97,7 @@ static cl::list<bool> LazyLink("lazy",
 
 enum class SpeculateKind { None, Simple };
 
-cl::opt<SpeculateKind> Speculate(
+static cl::opt<SpeculateKind> Speculate(
     "speculate", cl::desc("Choose speculation scheme"),
     cl::init(SpeculateKind::None),
     cl::values(clEnumValN(SpeculateKind::None, "none", "No speculation"),
@@ -105,13 +105,13 @@ cl::opt<SpeculateKind> Speculate(
                           "Simple speculation")),
     cl::cat(JITLinkCategory));
 
-cl::opt<std::string> SpeculateOrder(
+static cl::opt<std::string> SpeculateOrder(
     "speculate-order",
     cl::desc("A CSV file containing (JITDylib, Function) pairs to"
              "speculatively look up"),
     cl::cat(JITLinkCategory));
 
-cl::opt<std::string> RecordLazyExecs(
+static cl::opt<std::string> RecordLazyExecs(
     "record-lazy-execs",
     cl::desc("Write lazy-function executions to a CSV file as (JITDylib, "
              "function) pairs"),

diff  --git a/llvm/tools/llvm-lto/llvm-lto.cpp b/llvm/tools/llvm-lto/llvm-lto.cpp
index 4090faf4e3fd9..516c7b7c6c83e 100644
--- a/llvm/tools/llvm-lto/llvm-lto.cpp
+++ b/llvm/tools/llvm-lto/llvm-lto.cpp
@@ -109,7 +109,7 @@ enum ThinLTOModes {
   THINALL
 };
 
-cl::opt<ThinLTOModes> ThinLTOMode(
+static cl::opt<ThinLTOModes> ThinLTOMode(
     "thinlto-action", cl::desc("Perform a single ThinLTO stage:"),
     cl::values(
         clEnumValN(

diff  --git a/llvm/tools/llvm-lto2/llvm-lto2.cpp b/llvm/tools/llvm-lto2/llvm-lto2.cpp
index d4f022ef021a4..3ad2a3ecb6752 100644
--- a/llvm/tools/llvm-lto2/llvm-lto2.cpp
+++ b/llvm/tools/llvm-lto2/llvm-lto2.cpp
@@ -130,7 +130,7 @@ static cl::opt<bool> RemarksWithHotness(
     cl::desc("With PGO, include profile count in optimization remarks"),
     cl::Hidden);
 
-cl::opt<std::optional<uint64_t>, false, remarks::HotnessThresholdParser>
+static cl::opt<std::optional<uint64_t>, false, remarks::HotnessThresholdParser>
     RemarksHotnessThreshold(
         "pass-remarks-hotness-threshold",
         cl::desc("Minimum profile count required for an "

diff  --git a/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp b/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp
index 9da14cc52d6cb..680218e3fc96c 100644
--- a/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp
+++ b/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp
@@ -124,9 +124,9 @@ cl::SubCommand ExplainSubcommand("explain",
 cl::SubCommand ExportSubcommand("export",
                                 "Write binary data from a stream to a file");
 
-cl::OptionCategory TypeCategory("Symbol Type Options");
-cl::OptionCategory FilterCategory("Filtering and Sorting Options");
-cl::OptionCategory OtherOptions("Other Options");
+static cl::OptionCategory TypeCategory("Symbol Type Options");
+static cl::OptionCategory FilterCategory("Filtering and Sorting Options");
+static cl::OptionCategory OtherOptions("Other Options");
 
 cl::ValuesClass ChunkValues = cl::values(
     clEnumValN(ModuleSubsection::CrossScopeExports, "cme",
@@ -154,9 +154,10 @@ cl::ValuesClass ChunkValues = cl::values(
     clEnumValN(ModuleSubsection::All, "all", "All known subsections"));
 
 namespace diadump {
-cl::list<std::string> InputFilenames(cl::Positional,
-                                     cl::desc("<input PDB files>"),
-                                     cl::OneOrMore, cl::sub(DiaDumpSubcommand));
+static cl::list<std::string> InputFilenames(cl::Positional,
+                                            cl::desc("<input PDB files>"),
+                                            cl::OneOrMore,
+                                            cl::sub(DiaDumpSubcommand));
 
 cl::opt<bool> Native("native", cl::desc("Use native PDB reader instead of DIA"),
                      cl::sub(DiaDumpSubcommand));
@@ -198,9 +199,10 @@ static cl::opt<bool> Typedefs("typedefs", cl::desc("Dump typedefs"),
 FilterOptions Filters;
 
 namespace pretty {
-cl::list<std::string> InputFilenames(cl::Positional,
-                                     cl::desc("<input PDB files>"),
-                                     cl::OneOrMore, cl::sub(PrettySubcommand));
+static cl::list<std::string> InputFilenames(cl::Positional,
+                                            cl::desc("<input PDB files>"),
+                                            cl::OneOrMore,
+                                            cl::sub(PrettySubcommand));
 
 cl::opt<bool> InjectedSources("injected-sources",
                               cl::desc("Display injected sources"),
@@ -224,7 +226,7 @@ cl::opt<bool> Globals("globals", cl::desc("Dump global symbols"),
                       cl::cat(TypeCategory), cl::sub(PrettySubcommand));
 cl::opt<bool> Externals("externals", cl::desc("Dump external symbols"),
                         cl::cat(TypeCategory), cl::sub(PrettySubcommand));
-cl::list<SymLevel> SymTypes(
+static cl::list<SymLevel> SymTypes(
     "sym-types", cl::desc("Type of symbols to dump (default all)"),
     cl::cat(TypeCategory), cl::sub(PrettySubcommand),
     cl::values(
@@ -366,14 +368,14 @@ cl::opt<bool> NoEnumDefs("no-enum-definitions",
                          cl::cat(FilterCategory), cl::sub(PrettySubcommand));
 }
 
-cl::OptionCategory FileOptions("Module & File Options");
+static cl::OptionCategory FileOptions("Module & File Options");
 
 namespace bytes {
-cl::OptionCategory MsfBytes("MSF File Options");
-cl::OptionCategory DbiBytes("Dbi Stream Options");
-cl::OptionCategory PdbBytes("PDB Stream Options");
-cl::OptionCategory Types("Type Options");
-cl::OptionCategory ModuleCategory("Module Options");
+static cl::OptionCategory MsfBytes("MSF File Options");
+static cl::OptionCategory DbiBytes("Dbi Stream Options");
+static cl::OptionCategory PdbBytes("PDB Stream Options");
+static cl::OptionCategory Types("Type Options");
+static cl::OptionCategory ModuleCategory("Module Options");
 
 std::optional<NumberRange> DumpBlockRange;
 std::optional<NumberRange> DumpByteRange;
@@ -438,18 +440,19 @@ cl::opt<bool> SplitChunks(
     cl::desc(
         "When dumping debug chunks, show a 
diff erent section for each chunk"),
     cl::sub(BytesSubcommand), cl::cat(ModuleCategory));
-cl::list<std::string> InputFilenames(cl::Positional,
-                                     cl::desc("<input PDB files>"),
-                                     cl::OneOrMore, cl::sub(BytesSubcommand));
+static cl::list<std::string> InputFilenames(cl::Positional,
+                                            cl::desc("<input PDB files>"),
+                                            cl::OneOrMore,
+                                            cl::sub(BytesSubcommand));
 
 } // namespace bytes
 
 namespace dump {
 
-cl::OptionCategory MsfOptions("MSF Container Options");
-cl::OptionCategory TypeOptions("Type Record Options");
-cl::OptionCategory SymbolOptions("Symbol Options");
-cl::OptionCategory MiscOptions("Miscellaneous Options");
+static cl::OptionCategory MsfOptions("MSF Container Options");
+static cl::OptionCategory TypeOptions("Type Record Options");
+static cl::OptionCategory SymbolOptions("Symbol Options");
+static cl::OptionCategory MiscOptions("Miscellaneous Options");
 
 // MSF OPTIONS
 cl::opt<bool> DumpSummary("summary", cl::desc("dump file summary"),
@@ -640,9 +643,10 @@ cl::opt<bool> DumpSectionHeaders("section-headers",
 cl::opt<bool> RawAll("all", cl::desc("Implies most other options."),
                      cl::cat(MiscOptions), cl::sub(DumpSubcommand));
 
-cl::list<std::string> InputFilenames(cl::Positional,
-                                     cl::desc("<input PDB files>"),
-                                     cl::OneOrMore, cl::sub(DumpSubcommand));
+static cl::list<std::string> InputFilenames(cl::Positional,
+                                            cl::desc("<input PDB files>"),
+                                            cl::OneOrMore,
+                                            cl::sub(DumpSubcommand));
 }
 
 namespace yaml2pdb {
@@ -717,9 +721,10 @@ cl::list<std::string> InputFilename(cl::Positional,
 } // namespace pdb2yaml
 
 namespace merge {
-cl::list<std::string> InputFilenames(cl::Positional,
-                                     cl::desc("<input PDB files>"),
-                                     cl::OneOrMore, cl::sub(MergeSubcommand));
+static cl::list<std::string> InputFilenames(cl::Positional,
+                                            cl::desc("<input PDB files>"),
+                                            cl::OneOrMore,
+                                            cl::sub(MergeSubcommand));
 cl::opt<std::string>
     PdbOutputFile("pdb", cl::desc("the name of the PDB file to write"),
                   cl::sub(MergeSubcommand));
@@ -749,9 +754,10 @@ cl::opt<InputFileType> InputType(
 } // namespace explain
 
 namespace exportstream {
-cl::list<std::string> InputFilename(cl::Positional,
-                                    cl::desc("<input PDB file>"), cl::Required,
-                                    cl::sub(ExportSubcommand));
+static cl::list<std::string> InputFilename(cl::Positional,
+                                           cl::desc("<input PDB file>"),
+                                           cl::Required,
+                                           cl::sub(ExportSubcommand));
 cl::opt<std::string> OutputFile("out",
                                 cl::desc("The file to write the stream to"),
                                 cl::Required, cl::sub(ExportSubcommand));

diff  --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp
index 560210e59eeba..f0c9a417f3935 100644
--- a/llvm/tools/llvm-profdata/llvm-profdata.cpp
+++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp
@@ -99,46 +99,47 @@ cl::opt<std::string> OutputFilename("output", cl::value_desc("output"),
                                     cl::sub(MergeSubcommand));
 // NOTE: cl::alias must not have cl::sub(), since aliased option's cl::sub()
 // will be used. llvm::cl::alias::done() method asserts this condition.
-cl::alias OutputFilenameA("o", cl::desc("Alias for --output"),
-                          cl::aliasopt(OutputFilename));
+static cl::alias OutputFilenameA("o", cl::desc("Alias for --output"),
+                                 cl::aliasopt(OutputFilename));
 
 // Options common to at least two commands.
-cl::opt<ProfileKinds> ProfileKind(
+static cl::opt<ProfileKinds> ProfileKind(
     cl::desc("Profile kind:"), cl::sub(MergeSubcommand),
     cl::sub(OverlapSubcommand), cl::init(instr),
     cl::values(clEnumVal(instr, "Instrumentation profile (default)"),
                clEnumVal(sample, "Sample profile")));
-cl::opt<std::string> Filename(cl::Positional, cl::desc("<profdata-file>"),
-                              cl::sub(ShowSubcommand),
-                              cl::sub(OrderSubcommand));
-cl::opt<unsigned> MaxDbgCorrelationWarnings(
+static cl::opt<std::string> Filename(cl::Positional,
+                                     cl::desc("<profdata-file>"),
+                                     cl::sub(ShowSubcommand),
+                                     cl::sub(OrderSubcommand));
+static cl::opt<unsigned> MaxDbgCorrelationWarnings(
     "max-debug-info-correlation-warnings",
     cl::desc("The maximum number of warnings to emit when correlating "
              "profile from debug info (0 = no limit)"),
     cl::sub(MergeSubcommand), cl::sub(ShowSubcommand), cl::init(5));
-cl::opt<std::string> ProfiledBinary(
+static cl::opt<std::string> ProfiledBinary(
     "profiled-binary", cl::init(""),
     cl::desc("Path to binary from which the profile was collected."),
     cl::sub(ShowSubcommand), cl::sub(MergeSubcommand));
-cl::opt<std::string> DebugInfoFilename(
+static cl::opt<std::string> DebugInfoFilename(
     "debug-info", cl::init(""),
     cl::desc(
         "For show, read and extract profile metadata from debug info and show "
         "the functions it found. For merge, use the provided debug info to "
         "correlate the raw profile."),
     cl::sub(ShowSubcommand), cl::sub(MergeSubcommand));
-cl::opt<std::string>
+static cl::opt<std::string>
     BinaryFilename("binary-file", cl::init(""),
                    cl::desc("For merge, use the provided unstripped bianry to "
                             "correlate the raw profile."),
                    cl::sub(MergeSubcommand));
-cl::list<std::string> DebugFileDirectory(
+static cl::list<std::string> DebugFileDirectory(
     "debug-file-directory",
     cl::desc("Directories to search for object files by build ID"));
-cl::opt<bool> DebugInfod("debuginfod", cl::init(false), cl::Hidden,
-                         cl::sub(MergeSubcommand),
-                         cl::desc("Enable debuginfod"));
-cl::opt<ProfCorrelatorKind> BIDFetcherProfileCorrelate(
+static cl::opt<bool> DebugInfod("debuginfod", cl::init(false), cl::Hidden,
+                                cl::sub(MergeSubcommand),
+                                cl::desc("Enable debuginfod"));
+static cl::opt<ProfCorrelatorKind> BIDFetcherProfileCorrelate(
     "correlate",
     cl::desc("Use debug-info or binary correlation to correlate profiles with "
              "build id fetcher"),
@@ -149,7 +150,7 @@ cl::opt<ProfCorrelatorKind> BIDFetcherProfileCorrelate(
                           "Use debug info to correlate"),
                clEnumValN(InstrProfCorrelator::BINARY, "binary",
                           "Use binary to correlate")));
-cl::opt<std::string> FuncNameFilter(
+static cl::opt<std::string> FuncNameFilter(
     "function",
     cl::desc("Only functions matching the filter are shown in the output. For "
              "overlapping CSSPGO, this takes a function name with calling "
@@ -162,12 +163,13 @@ cl::opt<std::string> FuncNameFilter(
 // options.
 
 // Options specific to merge subcommand.
-cl::list<std::string> InputFilenames(cl::Positional, cl::sub(MergeSubcommand),
-                                     cl::desc("<filename...>"));
-cl::list<std::string> WeightedInputFilenames("weighted-input",
-                                             cl::sub(MergeSubcommand),
-                                             cl::desc("<weight>,<filename>"));
-cl::opt<ProfileFormat> OutputFormat(
+static cl::list<std::string> InputFilenames(cl::Positional,
+                                            cl::sub(MergeSubcommand),
+                                            cl::desc("<filename...>"));
+static cl::list<std::string>
+    WeightedInputFilenames("weighted-input", cl::sub(MergeSubcommand),
+                           cl::desc("<weight>,<filename>"));
+static cl::opt<ProfileFormat> OutputFormat(
     cl::desc("Format of output profile"), cl::sub(MergeSubcommand),
     cl::init(PF_Ext_Binary),
     cl::values(clEnumValN(PF_Binary, "binary", "Binary encoding"),
@@ -177,69 +179,69 @@ cl::opt<ProfileFormat> OutputFormat(
                clEnumValN(PF_Text, "text", "Text encoding"),
                clEnumValN(PF_GCC, "gcc",
                           "GCC encoding (only meaningful for -sample)")));
-cl::opt<std::string>
+static cl::opt<std::string>
     InputFilenamesFile("input-files", cl::init(""), cl::sub(MergeSubcommand),
                        cl::desc("Path to file containing newline-separated "
                                 "[<weight>,]<filename> entries"));
-cl::alias InputFilenamesFileA("f", cl::desc("Alias for --input-files"),
-                              cl::aliasopt(InputFilenamesFile));
-cl::opt<bool> DumpInputFileList(
+static cl::alias InputFilenamesFileA("f", cl::desc("Alias for --input-files"),
+                                     cl::aliasopt(InputFilenamesFile));
+static cl::opt<bool> DumpInputFileList(
     "dump-input-file-list", cl::init(false), cl::Hidden,
     cl::sub(MergeSubcommand),
     cl::desc("Dump the list of input files and their weights, then exit"));
-cl::opt<std::string> RemappingFile("remapping-file", cl::value_desc("file"),
-                                   cl::sub(MergeSubcommand),
-                                   cl::desc("Symbol remapping file"));
-cl::alias RemappingFileA("r", cl::desc("Alias for --remapping-file"),
-                         cl::aliasopt(RemappingFile));
-cl::opt<bool>
+static cl::opt<std::string> RemappingFile("remapping-file",
+                                          cl::value_desc("file"),
+                                          cl::sub(MergeSubcommand),
+                                          cl::desc("Symbol remapping file"));
+static cl::alias RemappingFileA("r", cl::desc("Alias for --remapping-file"),
+                                cl::aliasopt(RemappingFile));
+static cl::opt<bool>
     UseMD5("use-md5", cl::init(false), cl::Hidden,
            cl::desc("Choose to use MD5 to represent string in name table (only "
                     "meaningful for -extbinary)"),
            cl::sub(MergeSubcommand));
-cl::opt<bool> CompressAllSections(
+static cl::opt<bool> CompressAllSections(
     "compress-all-sections", cl::init(false), cl::Hidden,
     cl::sub(MergeSubcommand),
     cl::desc("Compress all sections when writing the profile (only "
              "meaningful for -extbinary)"));
-cl::opt<bool> SampleMergeColdContext(
+static cl::opt<bool> SampleMergeColdContext(
     "sample-merge-cold-context", cl::init(false), cl::Hidden,
     cl::sub(MergeSubcommand),
     cl::desc(
         "Merge context sample profiles whose count is below cold threshold"));
-cl::opt<bool> SampleTrimColdContext(
+static cl::opt<bool> SampleTrimColdContext(
     "sample-trim-cold-context", cl::init(false), cl::Hidden,
     cl::sub(MergeSubcommand),
     cl::desc(
         "Trim context sample profiles whose count is below cold threshold"));
-cl::opt<uint32_t> SampleColdContextFrameDepth(
+static cl::opt<uint32_t> SampleColdContextFrameDepth(
     "sample-frame-depth-for-cold-context", cl::init(1),
     cl::sub(MergeSubcommand),
     cl::desc("Keep the last K frames while merging cold profile. 1 means the "
              "context-less base profile"));
-cl::opt<size_t> OutputSizeLimit(
+static cl::opt<size_t> OutputSizeLimit(
     "output-size-limit", cl::init(0), cl::Hidden, cl::sub(MergeSubcommand),
     cl::desc("Trim cold functions until profile size is below specified "
              "limit in bytes. This uses a heursitic and functions may be "
              "excessively trimmed"));
-cl::opt<bool> GenPartialProfile(
+static cl::opt<bool> GenPartialProfile(
     "gen-partial-profile", cl::init(false), cl::Hidden,
     cl::sub(MergeSubcommand),
     cl::desc("Generate a partial profile (only meaningful for -extbinary)"));
-cl::opt<bool> SplitLayout(
-    "split-layout", cl::init(false), cl::Hidden,
-    cl::sub(MergeSubcommand),
+static cl::opt<bool> SplitLayout(
+    "split-layout", cl::init(false), cl::Hidden, cl::sub(MergeSubcommand),
     cl::desc("Split the profile to two sections with one containing sample "
              "profiles with inlined functions and the other without (only "
              "meaningful for -extbinary)"));
-cl::opt<std::string> SupplInstrWithSample(
+static cl::opt<std::string> SupplInstrWithSample(
     "supplement-instr-with-sample", cl::init(""), cl::Hidden,
     cl::sub(MergeSubcommand),
     cl::desc("Supplement an instr profile with sample profile, to correct "
              "the profile unrepresentativeness issue. The sample "
              "profile is the input of the flag. Output will be in instr "
              "format (The flag only works with -instr)"));
-cl::opt<float> ZeroCounterThreshold(
+static cl::opt<float> ZeroCounterThreshold(
     "zero-counter-threshold", cl::init(0.7), cl::Hidden,
     cl::sub(MergeSubcommand),
     cl::desc("For the function which is cold in instr profile but hot in "
@@ -247,13 +249,13 @@ cl::opt<float> ZeroCounterThreshold(
              "divided by the total number of counters is above the "
              "threshold, the profile of the function will be regarded as "
              "being harmful for performance and will be dropped."));
-cl::opt<unsigned> SupplMinSizeThreshold(
+static cl::opt<unsigned> SupplMinSizeThreshold(
     "suppl-min-size-threshold", cl::init(10), cl::Hidden,
     cl::sub(MergeSubcommand),
     cl::desc("If the size of a function is smaller than the threshold, "
              "assume it can be inlined by PGO early inliner and it won't "
              "be adjusted based on sample profile."));
-cl::opt<unsigned> InstrProfColdThreshold(
+static cl::opt<unsigned> InstrProfColdThreshold(
     "instr-prof-cold-threshold", cl::init(0), cl::Hidden,
     cl::sub(MergeSubcommand),
     cl::desc("User specified cold threshold for instr profile which will "
@@ -261,22 +263,21 @@ cl::opt<unsigned> InstrProfColdThreshold(
 // WARNING: This reservoir size value is propagated to any input indexed
 // profiles for simplicity. Changing this value between invocations could
 // result in sample bias.
-cl::opt<uint64_t> TemporalProfTraceReservoirSize(
+static cl::opt<uint64_t> TemporalProfTraceReservoirSize(
     "temporal-profile-trace-reservoir-size", cl::init(100),
     cl::sub(MergeSubcommand),
     cl::desc("The maximum number of stored temporal profile traces (default: "
              "100)"));
-cl::opt<uint64_t> TemporalProfMaxTraceLength(
+static cl::opt<uint64_t> TemporalProfMaxTraceLength(
     "temporal-profile-max-trace-length", cl::init(10000),
     cl::sub(MergeSubcommand),
     cl::desc("The maximum length of a single temporal profile trace "
              "(default: 10000)"));
-cl::opt<std::string> FuncNameNegativeFilter(
-    "no-function", cl::init(""),
-    cl::sub(MergeSubcommand),
+static cl::opt<std::string> FuncNameNegativeFilter(
+    "no-function", cl::init(""), cl::sub(MergeSubcommand),
     cl::desc("Exclude functions matching the filter from the output."));
 
-cl::opt<FailureMode>
+static cl::opt<FailureMode>
     FailMode("failure-mode", cl::init(failIfAnyAreInvalid),
              cl::desc("Failure mode:"), cl::sub(MergeSubcommand),
              cl::values(clEnumValN(warnOnly, "warn",
@@ -286,21 +287,21 @@ cl::opt<FailureMode>
                         clEnumValN(failIfAllAreInvalid, "all",
                                    "Fail only if all profiles are invalid.")));
 
-cl::opt<bool> OutputSparse(
+static cl::opt<bool> OutputSparse(
     "sparse", cl::init(false), cl::sub(MergeSubcommand),
     cl::desc("Generate a sparse profile (only meaningful for -instr)"));
-cl::opt<unsigned> NumThreads(
+static cl::opt<unsigned> NumThreads(
     "num-threads", cl::init(0), cl::sub(MergeSubcommand),
     cl::desc("Number of merge threads to use (default: autodetect)"));
-cl::alias NumThreadsA("j", cl::desc("Alias for --num-threads"),
-                      cl::aliasopt(NumThreads));
+static cl::alias NumThreadsA("j", cl::desc("Alias for --num-threads"),
+                             cl::aliasopt(NumThreads));
 
-cl::opt<std::string> ProfileSymbolListFile(
+static cl::opt<std::string> ProfileSymbolListFile(
     "prof-sym-list", cl::init(""), cl::sub(MergeSubcommand),
     cl::desc("Path to file containing the list of function symbols "
              "used to populate profile symbol list"));
 
-cl::opt<SampleProfileLayout> ProfileLayout(
+static cl::opt<SampleProfileLayout> ProfileLayout(
     "convert-sample-profile-layout",
     cl::desc("Convert the generated profile to a profile with a new layout"),
     cl::sub(MergeSubcommand), cl::init(SPL_None),
@@ -310,13 +311,13 @@ cl::opt<SampleProfileLayout> ProfileLayout(
         clEnumValN(SPL_Flat, "flat",
                    "Profile with nested inlinee flatten out")));
 
-cl::opt<bool> DropProfileSymbolList(
+static cl::opt<bool> DropProfileSymbolList(
     "drop-profile-symbol-list", cl::init(false), cl::Hidden,
     cl::sub(MergeSubcommand),
     cl::desc("Drop the profile symbol list when merging AutoFDO profiles "
              "(only meaningful for -sample)"));
 
-cl::opt<bool> KeepVTableSymbols(
+static cl::opt<bool> KeepVTableSymbols(
     "keep-vtable-symbols", cl::init(false), cl::Hidden,
     cl::sub(MergeSubcommand),
     cl::desc("If true, keep the vtable symbols in indexed profiles"));
@@ -325,19 +326,19 @@ cl::opt<bool> KeepVTableSymbols(
 // some forward compatibility.
 // TODO: Consider enabling this with future version changes as well, to ease
 // deployment of newer versions of llvm-profdata.
-cl::opt<bool> DoWritePrevVersion(
+static cl::opt<bool> DoWritePrevVersion(
     "write-prev-version", cl::init(false), cl::Hidden,
     cl::desc("Write the previous version of indexed format, to enable "
              "some forward compatibility."));
 
-cl::opt<memprof::IndexedVersion> MemProfVersionRequested(
+static cl::opt<memprof::IndexedVersion> MemProfVersionRequested(
     "memprof-version", cl::Hidden, cl::sub(MergeSubcommand),
     cl::desc("Specify the version of the memprof format to use"),
     cl::init(memprof::Version3),
     cl::values(clEnumValN(memprof::Version2, "2", "version 2"),
                clEnumValN(memprof::Version3, "3", "version 3")));
 
-cl::opt<bool> MemProfFullSchema(
+static cl::opt<bool> MemProfFullSchema(
     "memprof-full-schema", cl::Hidden, cl::sub(MergeSubcommand),
     cl::desc("Use the full schema for serialization"), cl::init(false));
 
@@ -351,26 +352,26 @@ static cl::opt<unsigned> MemprofGenerateRandomHotnessSeed(
     cl::desc("Random hotness seed to use (0 to generate new seed)"));
 
 // Options specific to overlap subcommand.
-cl::opt<std::string> BaseFilename(cl::Positional, cl::Required,
-                                  cl::desc("<base profile file>"),
-                                  cl::sub(OverlapSubcommand));
-cl::opt<std::string> TestFilename(cl::Positional, cl::Required,
-                                  cl::desc("<test profile file>"),
-                                  cl::sub(OverlapSubcommand));
-
-cl::opt<unsigned long long> SimilarityCutoff(
+static cl::opt<std::string> BaseFilename(cl::Positional, cl::Required,
+                                         cl::desc("<base profile file>"),
+                                         cl::sub(OverlapSubcommand));
+static cl::opt<std::string> TestFilename(cl::Positional, cl::Required,
+                                         cl::desc("<test profile file>"),
+                                         cl::sub(OverlapSubcommand));
+
+static cl::opt<unsigned long long> SimilarityCutoff(
     "similarity-cutoff", cl::init(0),
     cl::desc("For sample profiles, list function names (with calling context "
              "for csspgo) for overlapped functions "
              "with similarities below the cutoff (percentage times 10000)."),
     cl::sub(OverlapSubcommand));
 
-cl::opt<bool> IsCS(
+static cl::opt<bool> IsCS(
     "cs", cl::init(false),
     cl::desc("For context sensitive PGO counts. Does not work with CSSPGO."),
     cl::sub(OverlapSubcommand));
 
-cl::opt<unsigned long long> OverlapValueCutoff(
+static cl::opt<unsigned long long> OverlapValueCutoff(
     "value-cutoff", cl::init(-1),
     cl::desc(
         "Function level overlap information for every function (with calling "
@@ -379,10 +380,11 @@ cl::opt<unsigned long long> OverlapValueCutoff(
     cl::sub(OverlapSubcommand));
 
 // Options specific to show subcommand.
-cl::opt<bool> ShowCounts("counts", cl::init(false),
-                         cl::desc("Show counter values for shown functions"),
-                         cl::sub(ShowSubcommand));
-cl::opt<ShowFormat>
+static cl::opt<bool>
+    ShowCounts("counts", cl::init(false),
+               cl::desc("Show counter values for shown functions"),
+               cl::sub(ShowSubcommand));
+static cl::opt<ShowFormat>
     SFormat("show-format", cl::init(ShowFormat::Text),
             cl::desc("Emit output in the selected format if supported"),
             cl::sub(ShowSubcommand),
@@ -391,94 +393,97 @@ cl::opt<ShowFormat>
                        clEnumValN(ShowFormat::Json, "json", "emit JSON"),
                        clEnumValN(ShowFormat::Yaml, "yaml", "emit YAML")));
 // TODO: Consider replacing this with `--show-format=text-encoding`.
-cl::opt<bool>
+static cl::opt<bool>
     TextFormat("text", cl::init(false),
                cl::desc("Show instr profile data in text dump format"),
                cl::sub(ShowSubcommand));
-cl::opt<bool>
+static cl::opt<bool>
     JsonFormat("json",
                cl::desc("Show sample profile data in the JSON format "
                         "(deprecated, please use --show-format=json)"),
                cl::sub(ShowSubcommand));
-cl::opt<bool> ShowIndirectCallTargets(
+static cl::opt<bool> ShowIndirectCallTargets(
     "ic-targets", cl::init(false),
     cl::desc("Show indirect call site target values for shown functions"),
     cl::sub(ShowSubcommand));
-cl::opt<bool> ShowVTables("show-vtables", cl::init(false),
-                          cl::desc("Show vtable names for shown functions"),
-                          cl::sub(ShowSubcommand));
-cl::opt<bool> ShowMemOPSizes(
+static cl::opt<bool>
+    ShowVTables("show-vtables", cl::init(false),
+                cl::desc("Show vtable names for shown functions"),
+                cl::sub(ShowSubcommand));
+static cl::opt<bool> ShowMemOPSizes(
     "memop-sizes", cl::init(false),
     cl::desc("Show the profiled sizes of the memory intrinsic calls "
              "for shown functions"),
     cl::sub(ShowSubcommand));
-cl::opt<bool> ShowDetailedSummary("detailed-summary", cl::init(false),
-                                  cl::desc("Show detailed profile summary"),
-                                  cl::sub(ShowSubcommand));
-cl::list<uint32_t> DetailedSummaryCutoffs(
+static cl::opt<bool>
+    ShowDetailedSummary("detailed-summary", cl::init(false),
+                        cl::desc("Show detailed profile summary"),
+                        cl::sub(ShowSubcommand));
+static cl::list<uint32_t> DetailedSummaryCutoffs(
     cl::CommaSeparated, "detailed-summary-cutoffs",
     cl::desc(
         "Cutoff percentages (times 10000) for generating detailed summary"),
     cl::value_desc("800000,901000,999999"), cl::sub(ShowSubcommand));
-cl::opt<bool>
+static cl::opt<bool>
     ShowHotFuncList("hot-func-list", cl::init(false),
                     cl::desc("Show profile summary of a list of hot functions"),
                     cl::sub(ShowSubcommand));
-cl::opt<bool> ShowAllFunctions("all-functions", cl::init(false),
-                               cl::desc("Details for each and every function"),
-                               cl::sub(ShowSubcommand));
-cl::opt<bool> ShowCS("showcs", cl::init(false),
-                     cl::desc("Show context sensitive counts"),
+static cl::opt<bool>
+    ShowAllFunctions("all-functions", cl::init(false),
+                     cl::desc("Details for each and every function"),
                      cl::sub(ShowSubcommand));
-cl::opt<ProfileKinds> ShowProfileKind(
+static cl::opt<bool> ShowCS("showcs", cl::init(false),
+                            cl::desc("Show context sensitive counts"),
+                            cl::sub(ShowSubcommand));
+static cl::opt<ProfileKinds> ShowProfileKind(
     cl::desc("Profile kind supported by show:"), cl::sub(ShowSubcommand),
     cl::init(instr),
     cl::values(clEnumVal(instr, "Instrumentation profile (default)"),
                clEnumVal(sample, "Sample profile"),
                clEnumVal(memory, "MemProf memory access profile")));
-cl::opt<uint32_t> TopNFunctions(
+static cl::opt<uint32_t> TopNFunctions(
     "topn", cl::init(0),
     cl::desc("Show the list of functions with the largest internal counts"),
     cl::sub(ShowSubcommand));
-cl::opt<uint32_t> ShowValueCutoff(
+static cl::opt<uint32_t> ShowValueCutoff(
     "value-cutoff", cl::init(0),
     cl::desc("Set the count value cutoff. Functions with the maximum count "
              "less than this value will not be printed out. (Default is 0)"),
     cl::sub(ShowSubcommand));
-cl::opt<bool> OnlyListBelow(
+static cl::opt<bool> OnlyListBelow(
     "list-below-cutoff", cl::init(false),
     cl::desc("Only output names of functions whose max count values are "
              "below the cutoff value"),
     cl::sub(ShowSubcommand));
-cl::opt<bool> ShowProfileSymbolList(
+static cl::opt<bool> ShowProfileSymbolList(
     "show-prof-sym-list", cl::init(false),
     cl::desc("Show profile symbol list if it exists in the profile. "),
     cl::sub(ShowSubcommand));
-cl::opt<bool> ShowSectionInfoOnly(
+static cl::opt<bool> ShowSectionInfoOnly(
     "show-sec-info-only", cl::init(false),
     cl::desc("Show the information of each section in the sample profile. "
              "The flag is only usable when the sample profile is in "
              "extbinary format"),
     cl::sub(ShowSubcommand));
-cl::opt<bool> ShowBinaryIds("binary-ids", cl::init(false),
-                            cl::desc("Show binary ids in the profile. "),
-                            cl::sub(ShowSubcommand));
-cl::opt<bool> ShowTemporalProfTraces(
+static cl::opt<bool> ShowBinaryIds("binary-ids", cl::init(false),
+                                   cl::desc("Show binary ids in the profile. "),
+                                   cl::sub(ShowSubcommand));
+static cl::opt<bool> ShowTemporalProfTraces(
     "temporal-profile-traces",
     cl::desc("Show temporal profile traces in the profile."),
     cl::sub(ShowSubcommand));
 
-cl::opt<bool>
+static cl::opt<bool>
     ShowCovered("covered", cl::init(false),
                 cl::desc("Show only the functions that have been executed."),
                 cl::sub(ShowSubcommand));
 
-cl::opt<bool> ShowProfileVersion("profile-version", cl::init(false),
-                                 cl::desc("Show profile version. "),
-                                 cl::sub(ShowSubcommand));
+static cl::opt<bool> ShowProfileVersion("profile-version", cl::init(false),
+                                        cl::desc("Show profile version. "),
+                                        cl::sub(ShowSubcommand));
 
 // Options specific to order subcommand.
-cl::opt<unsigned>
+static cl::opt<unsigned>
     NumTestTraces("num-test-traces", cl::init(0),
                   cl::desc("Keep aside the last <num-test-traces> traces in "
                            "the profile when computing the function order and "

diff  --git a/llvm/tools/llvm-undname/llvm-undname.cpp b/llvm/tools/llvm-undname/llvm-undname.cpp
index d2d76def7ae0f..42fffeb9c1e45 100644
--- a/llvm/tools/llvm-undname/llvm-undname.cpp
+++ b/llvm/tools/llvm-undname/llvm-undname.cpp
@@ -28,35 +28,39 @@
 
 using namespace llvm;
 
-cl::OptionCategory UndNameCategory("UndName Options");
+static cl::OptionCategory UndNameCategory("UndName Options");
 
-cl::opt<bool> DumpBackReferences("backrefs", cl::Optional,
-                                 cl::desc("dump backreferences"), cl::Hidden,
-                                 cl::init(false), cl::cat(UndNameCategory));
-cl::opt<bool> NoAccessSpecifier("no-access-specifier", cl::Optional,
-                                cl::desc("skip access specifiers"), cl::Hidden,
-                                cl::init(false), cl::cat(UndNameCategory));
-cl::opt<bool> NoCallingConvention("no-calling-convention", cl::Optional,
-                                  cl::desc("skip calling convention"),
+static cl::opt<bool> DumpBackReferences("backrefs", cl::Optional,
+                                        cl::desc("dump backreferences"),
+                                        cl::Hidden, cl::init(false),
+                                        cl::cat(UndNameCategory));
+static cl::opt<bool> NoAccessSpecifier("no-access-specifier", cl::Optional,
+                                       cl::desc("skip access specifiers"),
+                                       cl::Hidden, cl::init(false),
+                                       cl::cat(UndNameCategory));
+static cl::opt<bool> NoCallingConvention("no-calling-convention", cl::Optional,
+                                         cl::desc("skip calling convention"),
+                                         cl::Hidden, cl::init(false),
+                                         cl::cat(UndNameCategory));
+static cl::opt<bool> NoReturnType("no-return-type", cl::Optional,
+                                  cl::desc("skip return types"), cl::Hidden,
+                                  cl::init(false), cl::cat(UndNameCategory));
+static cl::opt<bool> NoMemberType("no-member-type", cl::Optional,
+                                  cl::desc("skip member types"), cl::Hidden,
+                                  cl::init(false), cl::cat(UndNameCategory));
+static cl::opt<bool> NoVariableType("no-variable-type", cl::Optional,
+                                    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,
+                                  cl::desc("warn on trailing characters"),
                                   cl::Hidden, cl::init(false),
                                   cl::cat(UndNameCategory));
-cl::opt<bool> NoReturnType("no-return-type", cl::Optional,
-                           cl::desc("skip return types"), cl::Hidden,
-                           cl::init(false), cl::cat(UndNameCategory));
-cl::opt<bool> NoMemberType("no-member-type", cl::Optional,
-                           cl::desc("skip member types"), cl::Hidden,
-                           cl::init(false), cl::cat(UndNameCategory));
-cl::opt<bool> NoVariableType("no-variable-type", cl::Optional,
-                             cl::desc("skip variable types"), cl::Hidden,
-                             cl::init(false), cl::cat(UndNameCategory));
-cl::opt<std::string> RawFile("raw-file", cl::Optional,
-                             cl::desc("for fuzzer data"), cl::Hidden,
-                             cl::cat(UndNameCategory));
-cl::opt<bool> WarnTrailing("warn-trailing", cl::Optional,
-                           cl::desc("warn on trailing characters"), cl::Hidden,
-                           cl::init(false), cl::cat(UndNameCategory));
-cl::list<std::string> Symbols(cl::Positional, cl::desc("<input symbols>"),
-                              cl::cat(UndNameCategory));
+static cl::list<std::string> Symbols(cl::Positional,
+                                     cl::desc("<input symbols>"),
+                                     cl::cat(UndNameCategory));
 
 static bool msDemangle(const std::string &S) {
   int Status;

diff  --git a/llvm/tools/reduce-chunk-list/reduce-chunk-list.cpp b/llvm/tools/reduce-chunk-list/reduce-chunk-list.cpp
index a819af6e5f1a0..dc99859b516db 100644
--- a/llvm/tools/reduce-chunk-list/reduce-chunk-list.cpp
+++ b/llvm/tools/reduce-chunk-list/reduce-chunk-list.cpp
@@ -18,11 +18,11 @@
 
 using namespace llvm;
 
-cl::opt<std::string> ReproductionCmd(cl::Positional, cl::Required);
+static cl::opt<std::string> ReproductionCmd(cl::Positional, cl::Required);
 
-cl::opt<std::string> StartChunks(cl::Positional, cl::Required);
+static cl::opt<std::string> StartChunks(cl::Positional, cl::Required);
 
-cl::opt<bool> Pessimist("pessimist", cl::init(false));
+static cl::opt<bool> Pessimist("pessimist", cl::init(false));
 
 using Chunk = DebugCounter::Chunk;
 

diff  --git a/llvm/tools/yaml2obj/yaml2obj.cpp b/llvm/tools/yaml2obj/yaml2obj.cpp
index 4a060e1aad427..45aa3828311fe 100644
--- a/llvm/tools/yaml2obj/yaml2obj.cpp
+++ b/llvm/tools/yaml2obj/yaml2obj.cpp
@@ -35,7 +35,7 @@ cl::OptionCategory Cat("yaml2obj Options");
 cl::opt<std::string> Input(cl::Positional, cl::desc("<input file>"),
                            cl::init("-"), cl::cat(Cat));
 
-cl::list<std::string>
+static cl::list<std::string>
     D("D", cl::Prefix,
       cl::desc("Defined the specified macros to their specified "
                "definition. The syntax is <macro>=<definition>"),

diff  --git a/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp b/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
index f056306b2f857..57997a6b0e4e0 100644
--- a/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
+++ b/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
@@ -34,7 +34,7 @@ enum {
   HistOpcWidth = 40,
 };
 
-cl::OptionCategory DAGISelCat("Options for -gen-dag-isel");
+static cl::OptionCategory DAGISelCat("Options for -gen-dag-isel");
 
 // To reduce generated source code size.
 static cl::opt<bool> OmitComments("omit-comments",

diff  --git a/llvm/utils/TableGen/DecoderEmitter.cpp b/llvm/utils/TableGen/DecoderEmitter.cpp
index 4e591f580477e..425bf82c93dbe 100644
--- a/llvm/utils/TableGen/DecoderEmitter.cpp
+++ b/llvm/utils/TableGen/DecoderEmitter.cpp
@@ -60,7 +60,7 @@ enum SuppressLevel {
   SUPPRESSION_LEVEL2
 };
 
-cl::opt<SuppressLevel> DecoderEmitterSuppressDuplicates(
+static cl::opt<SuppressLevel> DecoderEmitterSuppressDuplicates(
     "suppress-per-hwmode-duplicates",
     cl::desc("Suppress duplication of instrs into per-HwMode decoder tables"),
     cl::values(

diff  --git a/llvm/utils/TableGen/GlobalISelEmitter.cpp b/llvm/utils/TableGen/GlobalISelEmitter.cpp
index 2969dd9156ccb..ccc4c00fca047 100644
--- a/llvm/utils/TableGen/GlobalISelEmitter.cpp
+++ b/llvm/utils/TableGen/GlobalISelEmitter.cpp
@@ -63,7 +63,7 @@ STATISTIC(NumPatternImportsSkipped, "Number of SelectionDAG imports skipped");
 STATISTIC(NumPatternsTested,
           "Number of patterns executed according to coverage information");
 
-cl::OptionCategory GlobalISelEmitterCat("Options for -gen-global-isel");
+static cl::OptionCategory GlobalISelEmitterCat("Options for -gen-global-isel");
 
 static cl::opt<bool> WarnOnSkippedPatterns(
     "warn-on-skipped-patterns",

diff  --git a/llvm/utils/TableGen/RegisterInfoEmitter.cpp b/llvm/utils/TableGen/RegisterInfoEmitter.cpp
index 752ebdf01b948..45c6db94023b7 100644
--- a/llvm/utils/TableGen/RegisterInfoEmitter.cpp
+++ b/llvm/utils/TableGen/RegisterInfoEmitter.cpp
@@ -47,7 +47,7 @@
 
 using namespace llvm;
 
-cl::OptionCategory RegisterInfoCat("Options for -gen-register-info");
+static cl::OptionCategory RegisterInfoCat("Options for -gen-register-info");
 
 static cl::opt<bool>
     RegisterInfoDebug("register-info-debug", cl::init(false),

diff  --git a/llvm/utils/yaml-bench/YAMLBench.cpp b/llvm/utils/yaml-bench/YAMLBench.cpp
index 4dc6caeb6fdbf..81304fe0ee4a0 100644
--- a/llvm/utils/yaml-bench/YAMLBench.cpp
+++ b/llvm/utils/yaml-bench/YAMLBench.cpp
@@ -52,7 +52,7 @@ static cl::opt<unsigned>
                   "Do not use more megabytes of memory"),
                 cl::init(1000));
 
-cl::opt<cl::boolOrDefault>
+static cl::opt<cl::boolOrDefault>
     UseColor("use-color", cl::desc("Emit colored output (default=autodetect)"),
              cl::init(cl::BOU_UNSET));
 


        


More information about the llvm-commits mailing list