[llvm] f199f97 - ModuleSummaryAnalysis: Internalize some cl::opt

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 23 17:33:40 PST 2022


Author: Fangrui Song
Date: 2022-11-23T17:33:34-08:00
New Revision: f199f97c720d0b031421b6e8607f57cb54f78c81

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

LOG: ModuleSummaryAnalysis: Internalize some cl::opt

Added: 
    

Modified: 
    llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
    llvm/lib/Bitcode/Writer/BitcodeWriter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
index e8309f51a4987..3dfa2d821e837 100644
--- a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
+++ b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
@@ -63,9 +63,12 @@ using namespace llvm::memprof;
 
 // Option to force edges cold which will block importing when the
 // -import-cold-multiplier is set to 0. Useful for debugging.
+namespace llvm {
 FunctionSummary::ForceSummaryHotnessType ForceSummaryEdgesCold =
     FunctionSummary::FSHT_None;
-cl::opt<FunctionSummary::ForceSummaryHotnessType, true> FSEC(
+} // namespace llvm
+
+static cl::opt<FunctionSummary::ForceSummaryHotnessType, true> FSEC(
     "force-summary-edges-cold", cl::Hidden, cl::location(ForceSummaryEdgesCold),
     cl::desc("Force all edges in the function summary to cold"),
     cl::values(clEnumValN(FunctionSummary::FSHT_None, "none", "None."),
@@ -73,10 +76,9 @@ cl::opt<FunctionSummary::ForceSummaryHotnessType, true> FSEC(
                           "all-non-critical", "All non-critical edges."),
                clEnumValN(FunctionSummary::FSHT_All, "all", "All edges.")));
 
-cl::opt<std::string> ModuleSummaryDotFile(
-    "module-summary-dot-file", cl::init(""), cl::Hidden,
-    cl::value_desc("filename"),
-    cl::desc("File to emit dot graph of new summary into."));
+static cl::opt<std::string> ModuleSummaryDotFile(
+    "module-summary-dot-file", cl::Hidden, cl::value_desc("filename"),
+    cl::desc("File to emit dot graph of new summary into"));
 
 // Walk through the operands of a given User via worklist iteration and populate
 // the set of GlobalValue references encountered. Invoked either on an

diff  --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index bc81afbc40646..bed9d6db2c79a 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -96,7 +96,9 @@ static cl::opt<bool> WriteRelBFToSummary(
     "write-relbf-to-summary", cl::Hidden, cl::init(false),
     cl::desc("Write relative block frequency to function summary "));
 
+namespace llvm {
 extern FunctionSummary::ForceSummaryHotnessType ForceSummaryEdgesCold;
+}
 
 namespace {
 


        


More information about the llvm-commits mailing list