diff --git a/llvm/lib/CodeGen/BasicBlockSections.cpp b/llvm/lib/CodeGen/BasicBlockSections.cpp index e7e73606de07..0325dc0ef496 100644 --- a/llvm/lib/CodeGen/BasicBlockSections.cpp +++ b/llvm/lib/CodeGen/BasicBlockSections.cpp @@ -91,7 +91,7 @@ cl::opt llvm::BBSectionsColdTextPrefix( cl::desc("The text prefix to use for cold basic block clusters"), cl::init(".text.split."), cl::Hidden); -cl::opt BBSectionsDetectSourceDrift( +static cl::opt BBSectionsDetectSourceDrift( "bbsections-detect-source-drift", cl::desc("This checks if there is a fdo instr. profile hash " "mismatch for this function"), diff --git a/llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp b/llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp index b36a86aa1b92..1ff4356b6046 100644 --- a/llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp +++ b/llvm/lib/CodeGen/MLRegallocEvictAdvisor.cpp @@ -83,12 +83,12 @@ static cl::opt EnableDevelopmentFeatures( static const bool EnableDevelopmentFeatures = false; #endif // #ifdef LLVM_HAVE_TFLITE -extern cl::opt EvictInterferenceCutoff; - /// The score injection pass. /// This pass calculates the score for a function and inserts it in the log, but /// this happens only in development mode. It's a no-op otherwise. namespace llvm { +extern cl::opt EvictInterferenceCutoff; + class RegAllocScoring : public MachineFunctionPass { public: static char ID; diff --git a/llvm/lib/CodeGen/MachineBlockPlacement.cpp b/llvm/lib/CodeGen/MachineBlockPlacement.cpp index 7bbc347a8cf8..ac4d59ead486 100644 --- a/llvm/lib/CodeGen/MachineBlockPlacement.cpp +++ b/llvm/lib/CodeGen/MachineBlockPlacement.cpp @@ -213,10 +213,9 @@ static cl::opt RenumberBlocksBeforeView( "into a dot graph. Only used when a function is being printed."), cl::init(false), cl::Hidden); +namespace llvm { extern cl::opt EnableExtTspBlockPlacement; extern cl::opt ApplyExtTspWithoutProfile; - -namespace llvm { extern cl::opt StaticLikelyProb; extern cl::opt ProfileLikelyProb; diff --git a/llvm/lib/CodeGen/RegAllocEvictionAdvisor.cpp b/llvm/lib/CodeGen/RegAllocEvictionAdvisor.cpp index 048496f452da..daba130bf158 100644 --- a/llvm/lib/CodeGen/RegAllocEvictionAdvisor.cpp +++ b/llvm/lib/CodeGen/RegAllocEvictionAdvisor.cpp @@ -43,6 +43,7 @@ static cl::opt EnableLocalReassignment( "may be compile time intensive"), cl::init(false)); +namespace llvm { cl::opt EvictInterferenceCutoff( "regalloc-eviction-max-interference-cutoff", cl::Hidden, cl::desc("Number of interferences after which we declare " @@ -50,6 +51,7 @@ cl::opt EvictInterferenceCutoff( "is a compilation cost-saving consideration. To " "disable, pass a very large number."), cl::init(10)); +} #define DEBUG_TYPE "regalloc" #ifdef LLVM_HAVE_TF_AOT_REGALLOCEVICTMODEL diff --git a/llvm/lib/Object/IRSymtab.cpp b/llvm/lib/Object/IRSymtab.cpp index e31693230fe9..20fee4473080 100644 --- a/llvm/lib/Object/IRSymtab.cpp +++ b/llvm/lib/Object/IRSymtab.cpp @@ -41,8 +41,8 @@ using namespace llvm; using namespace irsymtab; -cl::opt DisableBitcodeVersionUpgrade( - "disable-bitcode-version-upgrade", cl::init(false), cl::Hidden, +static cl::opt DisableBitcodeVersionUpgrade( + "disable-bitcode-version-upgrade", cl::Hidden, cl::desc("Disable automatic bitcode upgrade for version mismatch")); static const char *PreservedSymbols[] = { diff --git a/llvm/lib/ProfileData/SampleProf.cpp b/llvm/lib/ProfileData/SampleProf.cpp index b4d5550a1721..198209c91f3a 100644 --- a/llvm/lib/ProfileData/SampleProf.cpp +++ b/llvm/lib/ProfileData/SampleProf.cpp @@ -32,7 +32,7 @@ static cl::opt ProfileSymbolListCutOff( cl::desc("Cutoff value about how many symbols in profile symbol list " "will be used. This is very useful for performance debugging")); -cl::opt GenerateMergedBaseProfiles( +static cl::opt GenerateMergedBaseProfiles( "generate-merged-base-profiles", cl::desc("When generating nested context-sensitive profiles, always " "generate extra base profile for function with all its context " diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp index 9dfef80ca206..3086cd6d16b6 100644 --- a/llvm/lib/Transforms/IPO/SampleProfile.cpp +++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp @@ -174,9 +174,6 @@ static cl::opt cl::desc("Process functions in a top-down order " "defined by the profiled call graph when " "-sample-profile-top-down-load is on.")); -cl::opt - SortProfiledSCC("sort-profiled-scc-member", cl::init(true), cl::Hidden, - cl::desc("Sort profiled recursion by edge weights.")); static cl::opt ProfileSizeInline( "sample-profile-inline-size", cl::Hidden, cl::init(false), @@ -192,6 +189,11 @@ static cl::opt DisableSampleLoaderInlining( "pass, and merge (or scale) profiles (as configured by " "--sample-profile-merge-inlinee).")); +namespace llvm { +cl::opt + SortProfiledSCC("sort-profiled-scc-member", cl::init(true), cl::Hidden, + cl::desc("Sort profiled recursion by edge weights.")); + cl::opt ProfileInlineGrowthLimit( "sample-profile-inline-growth-limit", cl::Hidden, cl::init(12), cl::desc("The size growth ratio limit for proirity-based sample profile " @@ -215,6 +217,7 @@ cl::opt SampleHotCallSiteThreshold( cl::opt SampleColdCallSiteThreshold( "sample-profile-cold-inline-threshold", cl::Hidden, cl::init(45), cl::desc("Threshold for inlining cold callsites")); +} // namespace llvm static cl::opt ProfileICPRelativeHotness( "sample-profile-icp-relative-hotness", cl::Hidden, cl::init(25), @@ -308,7 +311,9 @@ static cl::opt AnnotateSampleProfileInlinePhase( cl::desc("Annotate LTO phase (prelink / postlink), or main (no LTO) for " "sample-profile inline pass name.")); +namespace llvm { extern cl::opt EnableExtTspBlockPlacement; +} namespace { diff --git a/llvm/lib/Transforms/Utils/CodeLayout.cpp b/llvm/lib/Transforms/Utils/CodeLayout.cpp index 9eb3aff3ffe8..46980c56c02c 100644 --- a/llvm/lib/Transforms/Utils/CodeLayout.cpp +++ b/llvm/lib/Transforms/Utils/CodeLayout.cpp @@ -47,6 +47,7 @@ using namespace llvm; #define DEBUG_TYPE "code-layout" +namespace llvm { cl::opt EnableExtTspBlockPlacement( "enable-ext-tsp-block-placement", cl::Hidden, cl::init(false), cl::desc("Enable machine block placement based on the ext-tsp model, " @@ -56,6 +57,7 @@ cl::opt ApplyExtTspWithoutProfile( "ext-tsp-apply-without-profile", cl::desc("Whether to apply ext-tsp placement for instances w/o profile"), cl::init(true), cl::Hidden); +} // namespace llvm // Algorithm-specific params. The values are tuned for the best performance // of large-scale front-end bound binaries. diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index 110b927eafa5..06148a59db02 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -338,10 +338,12 @@ static cl::opt PreferPredicatedReductionSelect( cl::desc( "Prefer predicating a reduction operation over an after loop select.")); +namespace llvm { cl::opt EnableVPlanNativePath( - "enable-vplan-native-path", cl::init(false), cl::Hidden, + "enable-vplan-native-path", cl::Hidden, cl::desc("Enable VPlan-native vectorization path with " "support for outer loop vectorization.")); +} // This flag enables the stress testing of the VPlan H-CFG construction in the // VPlan-native vectorization path. It must be used in conjuction with diff --git a/llvm/lib/Transforms/Vectorize/VPlan.cpp b/llvm/lib/Transforms/Vectorize/VPlan.cpp index d554f438c804..04f08811f5f5 100644 --- a/llvm/lib/Transforms/Vectorize/VPlan.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp @@ -46,7 +46,10 @@ #include using namespace llvm; + +namespace llvm { extern cl::opt EnableVPlanNativePath; +} #define DEBUG_TYPE "vplan" diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp index ff0b1df57ce4..fb17f1592c31 100644 --- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp @@ -34,7 +34,9 @@ using namespace llvm; using VectorParts = SmallVector; +namespace llvm { extern cl::opt EnableVPlanNativePath; +} #define LV_NAME "loop-vectorize" #define DEBUG_TYPE LV_NAME diff --git a/llvm/tools/llvm-profgen/CSPreInliner.cpp b/llvm/tools/llvm-profgen/CSPreInliner.cpp index 54e86401a863..6551eb8dd82a 100644 --- a/llvm/tools/llvm-profgen/CSPreInliner.cpp +++ b/llvm/tools/llvm-profgen/CSPreInliner.cpp @@ -34,6 +34,7 @@ STATISTIC( // The switches specify inline thresholds used in SampleProfileLoader inlining. // TODO: the actual threshold to be tuned here because the size here is based // on machine code not LLVM IR. +namespace llvm { extern cl::opt SampleHotCallSiteThreshold; extern cl::opt SampleColdCallSiteThreshold; extern cl::opt ProfileInlineGrowthLimit; @@ -49,6 +50,7 @@ cl::opt EnableCSPreInliner( cl::opt UseContextCostForPreInliner( "use-context-cost-for-preinliner", cl::Hidden, cl::init(true), cl::desc("Use context-sensitive byte size cost for preinliner decisions")); +} // namespace llvm static cl::opt SamplePreInlineReplay( "csspgo-replay-preinline", cl::Hidden, cl::init(false), diff --git a/llvm/tools/llvm-profgen/ProfiledBinary.h b/llvm/tools/llvm-profgen/ProfiledBinary.h index cdbaec740b4a..c410b98200de 100644 --- a/llvm/tools/llvm-profgen/ProfiledBinary.h +++ b/llvm/tools/llvm-profgen/ProfiledBinary.h @@ -42,8 +42,10 @@ #include #include +namespace llvm { extern cl::opt EnableCSPreInliner; extern cl::opt UseContextCostForPreInliner; +} // namespace llvm using namespace llvm; using namespace sampleprof;