Skip to content

Commit 2d854dd

Browse files
committed
Move global namespace cl::opt inside llvm:: or internalize them
1 parent f3c92a0 commit 2d854dd

File tree

11 files changed

+23
-8
lines changed

11 files changed

+23
-8
lines changed

llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
using namespace llvm;
2727

28+
namespace llvm {
2829
cl::opt<bool> EnableDetailedFunctionProperties(
2930
"enable-detailed-function-properties", cl::Hidden, cl::init(false),
3031
cl::desc("Whether or not to compute detailed function properties."));
@@ -38,8 +39,9 @@ cl::opt<unsigned> MediumBasicBlockInstructionThreshold(
3839
"medium-basic-block-instruction-threshold", cl::Hidden, cl::init(15),
3940
cl::desc("The minimum number of instructions a basic block should contain "
4041
"before being considered medium-sized."));
42+
}
4143

42-
cl::opt<unsigned> CallWithManyArgumentsThreshold(
44+
static cl::opt<unsigned> CallWithManyArgumentsThreshold(
4345
"call-with-many-arguments-threshold", cl::Hidden, cl::init(4),
4446
cl::desc("The minimum number of arguments a function call must have before "
4547
"it is considered having many arguments."));

llvm/lib/CodeGen/MIRFSDiscriminator.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@ using namespace sampleprofutil;
3535

3636
// TODO(xur): Remove this option and related code once we make true as the
3737
// default.
38+
namespace llvm {
3839
cl::opt<bool> ImprovedFSDiscriminator(
3940
"improved-fs-discriminator", cl::Hidden, cl::init(false),
4041
cl::desc("New FS discriminators encoding (incompatible with the original "
4142
"encoding)"));
43+
}
4244

4345
char MIRAddFSDiscriminators::ID = 0;
4446

llvm/lib/CodeGen/MIRSampleProfile.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ static cl::opt<bool> ViewBFIAfter("fs-viewbfi-after", cl::Hidden,
6161
cl::init(false),
6262
cl::desc("View BFI after MIR loader"));
6363

64+
namespace llvm {
6465
extern cl::opt<bool> ImprovedFSDiscriminator;
66+
}
6567
char MIRProfileLoaderPass::ID = 0;
6668

6769
INITIALIZE_PASS_BEGIN(MIRProfileLoaderPass, DEBUG_TYPE,

llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,15 @@ STATISTIC(NumOfStatepoints, "Number of statepoint nodes encountered");
6262
STATISTIC(StatepointMaxSlotsRequired,
6363
"Maximum number of stack slots required for a singe statepoint");
6464

65-
cl::opt<bool> UseRegistersForDeoptValues(
65+
static cl::opt<bool> UseRegistersForDeoptValues(
6666
"use-registers-for-deopt-values", cl::Hidden, cl::init(false),
6767
cl::desc("Allow using registers for non pointer deopt args"));
6868

69-
cl::opt<bool> UseRegistersForGCPointersInLandingPad(
69+
static cl::opt<bool> UseRegistersForGCPointersInLandingPad(
7070
"use-registers-for-gc-values-in-landing-pad", cl::Hidden, cl::init(false),
7171
cl::desc("Allow using registers for gc pointer in landing pad"));
7272

73-
cl::opt<unsigned> MaxRegistersForGCPointers(
73+
static cl::opt<unsigned> MaxRegistersForGCPointers(
7474
"max-registers-for-gc-values", cl::Hidden, cl::init(0),
7575
cl::desc("Max number of VRegs allowed to pass GC pointer meta args in"));
7676

llvm/lib/LTO/LTO.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,14 @@ namespace llvm {
7474
cl::opt<bool> EnableLTOInternalization(
7575
"enable-lto-internalization", cl::init(true), cl::Hidden,
7676
cl::desc("Enable global value internalization in LTO"));
77-
}
7877

7978
/// Indicate we are linking with an allocator that supports hot/cold operator
8079
/// new interfaces.
8180
extern cl::opt<bool> SupportsHotColdNew;
8281

8382
/// Enable MemProf context disambiguation for thin link.
8483
extern cl::opt<bool> EnableMemProfContextDisambiguation;
84+
} // namespace llvm
8585

8686
// Computes a unique hash for the Module considering the current list of
8787
// export/import and other global analysis results.

llvm/lib/Passes/PassBuilderPipelines.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,11 +276,13 @@ static cl::opt<bool> UseLoopVersioningLICM(
276276
"enable-loop-versioning-licm", cl::init(false), cl::Hidden,
277277
cl::desc("Enable the experimental Loop Versioning LICM pass"));
278278

279+
namespace llvm {
279280
cl::opt<bool> EnableMemProfContextDisambiguation(
280281
"enable-memprof-context-disambiguation", cl::init(false), cl::Hidden,
281282
cl::ZeroOrMore, cl::desc("Enable MemProf context disambiguation"));
282283

283284
extern cl::opt<bool> EnableInferAlignmentPass;
285+
} // namespace llvm
284286

285287
PipelineTuningOptions::PipelineTuningOptions() {
286288
LoopInterleaving = true;

llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,13 @@ static cl::opt<std::string> MemProfImportSummary(
104104
cl::desc("Import summary to use for testing the ThinLTO backend via opt"),
105105
cl::Hidden);
106106

107+
namespace llvm {
107108
// Indicate we are linking with an allocator that supports hot/cold operator
108109
// new interfaces.
109110
cl::opt<bool> SupportsHotColdNew(
110111
"supports-hot-cold-new", cl::init(false), cl::Hidden,
111112
cl::desc("Linking with hot/cold operator new interfaces"));
113+
} // namespace llvm
112114

113115
namespace {
114116
/// CRTP base for graphs built from either IR or ThinLTO summary index.

llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,12 @@ static cl::opt<unsigned> MaxCopiedFromConstantUsers(
3636
cl::desc("Maximum users to visit in copy from constant transform"),
3737
cl::Hidden);
3838

39+
namespace llvm {
3940
cl::opt<bool> EnableInferAlignmentPass(
4041
"enable-infer-alignment-pass", cl::init(true), cl::Hidden, cl::ZeroOrMore,
4142
cl::desc("Enable the InferAlignment pass, disabling alignment inference in "
4243
"InstCombine"));
44+
}
4345

4446
/// isOnlyCopiedFromConstantMemory - Recursively walk the uses of a (derived)
4547
/// pointer to an alloca. Ignore any reads of the pointer, return false if we

llvm/lib/Transforms/Scalar/LICM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ static cl::opt<uint32_t> MaxNumUsesTraversed(
129129
cl::desc("Max num uses visited for identifying load "
130130
"invariance in loop using invariant start (default = 8)"));
131131

132-
cl::opt<unsigned> FPAssociationUpperLimit(
132+
static cl::opt<unsigned> FPAssociationUpperLimit(
133133
"licm-max-num-fp-reassociations", cl::init(5U), cl::Hidden,
134134
cl::desc(
135135
"Set upper limit for the number of transformations performed "

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,9 @@ using namespace slpvectorizer;
108108

109109
STATISTIC(NumVectorInstructions, "Number of vector instructions generated");
110110

111-
cl::opt<bool> RunSLPVectorization("vectorize-slp", cl::init(true), cl::Hidden,
112-
cl::desc("Run the SLP vectorization passes"));
111+
static cl::opt<bool>
112+
RunSLPVectorization("vectorize-slp", cl::init(true), cl::Hidden,
113+
cl::desc("Run the SLP vectorization passes"));
113114

114115
static cl::opt<int>
115116
SLPCostThreshold("slp-threshold", cl::init(0), cl::Hidden,

llvm/unittests/Analysis/FunctionPropertiesAnalysisTest.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@
2525

2626
using namespace llvm;
2727

28+
namespace llvm {
2829
extern cl::opt<bool> EnableDetailedFunctionProperties;
2930
extern cl::opt<bool> BigBasicBlockInstructionThreshold;
3031
extern cl::opt<bool> MediumBasicBlockInstrutionThreshold;
32+
} // namespace llvm
3133

3234
namespace {
3335

0 commit comments

Comments
 (0)