Skip to content

Commit 1e69211

Browse files
committed
Move global namespace cl::opt inside llvm::
1 parent 4f0eb57 commit 1e69211

13 files changed

+31
-12
lines changed

llvm/lib/CodeGen/BasicBlockSections.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ cl::opt<std::string> llvm::BBSectionsColdTextPrefix(
9191
cl::desc("The text prefix to use for cold basic block clusters"),
9292
cl::init(".text.split."), cl::Hidden);
9393

94-
cl::opt<bool> BBSectionsDetectSourceDrift(
94+
static cl::opt<bool> BBSectionsDetectSourceDrift(
9595
"bbsections-detect-source-drift",
9696
cl::desc("This checks if there is a fdo instr. profile hash "
9797
"mismatch for this function"),

llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,12 @@ static cl::opt<bool> EnableDevelopmentFeatures(
8383
static const bool EnableDevelopmentFeatures = false;
8484
#endif // #ifdef LLVM_HAVE_TFLITE
8585

86-
extern cl::opt<unsigned> EvictInterferenceCutoff;
87-
8886
/// The score injection pass.
8987
/// This pass calculates the score for a function and inserts it in the log, but
9088
/// this happens only in development mode. It's a no-op otherwise.
9189
namespace llvm {
90+
extern cl::opt<unsigned> EvictInterferenceCutoff;
91+
9292
class RegAllocScoring : public MachineFunctionPass {
9393
public:
9494
static char ID;

llvm/lib/CodeGen/MachineBlockPlacement.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,9 @@ static cl::opt<bool> RenumberBlocksBeforeView(
213213
"into a dot graph. Only used when a function is being printed."),
214214
cl::init(false), cl::Hidden);
215215

216+
namespace llvm {
216217
extern cl::opt<bool> EnableExtTspBlockPlacement;
217218
extern cl::opt<bool> ApplyExtTspWithoutProfile;
218-
219-
namespace llvm {
220219
extern cl::opt<unsigned> StaticLikelyProb;
221220
extern cl::opt<unsigned> ProfileLikelyProb;
222221

llvm/lib/CodeGen/RegAllocEvictionAdvisor.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,15 @@ static cl::opt<bool> EnableLocalReassignment(
4343
"may be compile time intensive"),
4444
cl::init(false));
4545

46+
namespace llvm {
4647
cl::opt<unsigned> EvictInterferenceCutoff(
4748
"regalloc-eviction-max-interference-cutoff", cl::Hidden,
4849
cl::desc("Number of interferences after which we declare "
4950
"an interference unevictable and bail out. This "
5051
"is a compilation cost-saving consideration. To "
5152
"disable, pass a very large number."),
5253
cl::init(10));
54+
}
5355

5456
#define DEBUG_TYPE "regalloc"
5557
#ifdef LLVM_HAVE_TF_AOT_REGALLOCEVICTMODEL

llvm/lib/Object/IRSymtab.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
using namespace llvm;
4242
using namespace irsymtab;
4343

44-
cl::opt<bool> DisableBitcodeVersionUpgrade(
45-
"disable-bitcode-version-upgrade", cl::init(false), cl::Hidden,
44+
static cl::opt<bool> DisableBitcodeVersionUpgrade(
45+
"disable-bitcode-version-upgrade", cl::Hidden,
4646
cl::desc("Disable automatic bitcode upgrade for version mismatch"));
4747

4848
static const char *PreservedSymbols[] = {

llvm/lib/ProfileData/SampleProf.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ static cl::opt<uint64_t> ProfileSymbolListCutOff(
3232
cl::desc("Cutoff value about how many symbols in profile symbol list "
3333
"will be used. This is very useful for performance debugging"));
3434

35-
cl::opt<bool> GenerateMergedBaseProfiles(
35+
static cl::opt<bool> GenerateMergedBaseProfiles(
3636
"generate-merged-base-profiles",
3737
cl::desc("When generating nested context-sensitive profiles, always "
3838
"generate extra base profile for function with all its context "

llvm/lib/Transforms/IPO/SampleProfile.cpp

+8-3
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,6 @@ static cl::opt<bool>
174174
cl::desc("Process functions in a top-down order "
175175
"defined by the profiled call graph when "
176176
"-sample-profile-top-down-load is on."));
177-
cl::opt<bool>
178-
SortProfiledSCC("sort-profiled-scc-member", cl::init(true), cl::Hidden,
179-
cl::desc("Sort profiled recursion by edge weights."));
180177

181178
static cl::opt<bool> ProfileSizeInline(
182179
"sample-profile-inline-size", cl::Hidden, cl::init(false),
@@ -192,6 +189,11 @@ static cl::opt<bool> DisableSampleLoaderInlining(
192189
"pass, and merge (or scale) profiles (as configured by "
193190
"--sample-profile-merge-inlinee)."));
194191

192+
namespace llvm {
193+
cl::opt<bool>
194+
SortProfiledSCC("sort-profiled-scc-member", cl::init(true), cl::Hidden,
195+
cl::desc("Sort profiled recursion by edge weights."));
196+
195197
cl::opt<int> ProfileInlineGrowthLimit(
196198
"sample-profile-inline-growth-limit", cl::Hidden, cl::init(12),
197199
cl::desc("The size growth ratio limit for proirity-based sample profile "
@@ -215,6 +217,7 @@ cl::opt<int> SampleHotCallSiteThreshold(
215217
cl::opt<int> SampleColdCallSiteThreshold(
216218
"sample-profile-cold-inline-threshold", cl::Hidden, cl::init(45),
217219
cl::desc("Threshold for inlining cold callsites"));
220+
} // namespace llvm
218221

219222
static cl::opt<unsigned> ProfileICPRelativeHotness(
220223
"sample-profile-icp-relative-hotness", cl::Hidden, cl::init(25),
@@ -308,7 +311,9 @@ static cl::opt<bool> AnnotateSampleProfileInlinePhase(
308311
cl::desc("Annotate LTO phase (prelink / postlink), or main (no LTO) for "
309312
"sample-profile inline pass name."));
310313

314+
namespace llvm {
311315
extern cl::opt<bool> EnableExtTspBlockPlacement;
316+
}
312317

313318
namespace {
314319

llvm/lib/Transforms/Utils/CodeLayout.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
using namespace llvm;
4848
#define DEBUG_TYPE "code-layout"
4949

50+
namespace llvm {
5051
cl::opt<bool> EnableExtTspBlockPlacement(
5152
"enable-ext-tsp-block-placement", cl::Hidden, cl::init(false),
5253
cl::desc("Enable machine block placement based on the ext-tsp model, "
@@ -56,6 +57,7 @@ cl::opt<bool> ApplyExtTspWithoutProfile(
5657
"ext-tsp-apply-without-profile",
5758
cl::desc("Whether to apply ext-tsp placement for instances w/o profile"),
5859
cl::init(true), cl::Hidden);
60+
} // namespace llvm
5961

6062
// Algorithm-specific params. The values are tuned for the best performance
6163
// of large-scale front-end bound binaries.

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,12 @@ static cl::opt<bool> PreferPredicatedReductionSelect(
338338
cl::desc(
339339
"Prefer predicating a reduction operation over an after loop select."));
340340

341+
namespace llvm {
341342
cl::opt<bool> EnableVPlanNativePath(
342-
"enable-vplan-native-path", cl::init(false), cl::Hidden,
343+
"enable-vplan-native-path", cl::Hidden,
343344
cl::desc("Enable VPlan-native vectorization path with "
344345
"support for outer loop vectorization."));
346+
}
345347

346348
// This flag enables the stress testing of the VPlan H-CFG construction in the
347349
// VPlan-native vectorization path. It must be used in conjuction with

llvm/lib/Transforms/Vectorize/VPlan.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@
4646
#include <vector>
4747

4848
using namespace llvm;
49+
50+
namespace llvm {
4951
extern cl::opt<bool> EnableVPlanNativePath;
52+
}
5053

5154
#define DEBUG_TYPE "vplan"
5255

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ using namespace llvm;
3434

3535
using VectorParts = SmallVector<Value *, 2>;
3636

37+
namespace llvm {
3738
extern cl::opt<bool> EnableVPlanNativePath;
39+
}
3840

3941
#define LV_NAME "loop-vectorize"
4042
#define DEBUG_TYPE LV_NAME

llvm/tools/llvm-profgen/CSPreInliner.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ STATISTIC(
3434
// The switches specify inline thresholds used in SampleProfileLoader inlining.
3535
// TODO: the actual threshold to be tuned here because the size here is based
3636
// on machine code not LLVM IR.
37+
namespace llvm {
3738
extern cl::opt<int> SampleHotCallSiteThreshold;
3839
extern cl::opt<int> SampleColdCallSiteThreshold;
3940
extern cl::opt<int> ProfileInlineGrowthLimit;
@@ -49,6 +50,7 @@ cl::opt<bool> EnableCSPreInliner(
4950
cl::opt<bool> UseContextCostForPreInliner(
5051
"use-context-cost-for-preinliner", cl::Hidden, cl::init(true),
5152
cl::desc("Use context-sensitive byte size cost for preinliner decisions"));
53+
} // namespace llvm
5254

5355
static cl::opt<bool> SamplePreInlineReplay(
5456
"csspgo-replay-preinline", cl::Hidden, cl::init(false),

llvm/tools/llvm-profgen/ProfiledBinary.h

+2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@
4242
#include <unordered_set>
4343
#include <vector>
4444

45+
namespace llvm {
4546
extern cl::opt<bool> EnableCSPreInliner;
4647
extern cl::opt<bool> UseContextCostForPreInliner;
48+
} // namespace llvm
4749

4850
using namespace llvm;
4951
using namespace sampleprof;

0 commit comments

Comments
 (0)