diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index ccaf1e97e8e1b..b0fe8e03aa0f5 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -70,6 +70,7 @@ #include "llvm/Transforms/Instrumentation/KCFI.h" #include "llvm/Transforms/Instrumentation/MemProfiler.h" #include "llvm/Transforms/Instrumentation/MemorySanitizer.h" +#include "llvm/Transforms/Instrumentation/PGOInstrumentation.h" #include "llvm/Transforms/Instrumentation/SanitizerBinaryMetadata.h" #include "llvm/Transforms/Instrumentation/SanitizerCoverage.h" #include "llvm/Transforms/Instrumentation/ThreadSanitizer.h" @@ -90,7 +91,6 @@ using namespace llvm; #include "llvm/Support/Extension.def" namespace llvm { -extern cl::opt DebugInfoCorrelate; extern cl::opt PrintPipelinePasses; // Experiment to move sanitizers earlier. diff --git a/llvm/include/llvm/ProfileData/ProfileCommon.h b/llvm/include/llvm/ProfileData/ProfileCommon.h index 4fe92cef4d726..eaab59484c947 100644 --- a/llvm/include/llvm/ProfileData/ProfileCommon.h +++ b/llvm/include/llvm/ProfileData/ProfileCommon.h @@ -28,6 +28,14 @@ namespace llvm { +extern cl::opt UseContextLessSummary; +extern cl::opt ProfileSummaryCutoffHot; +extern cl::opt ProfileSummaryCutoffCold; +extern cl::opt ProfileSummaryHugeWorkingSetSizeThreshold; +extern cl::opt ProfileSummaryLargeWorkingSetSizeThreshold; +extern cl::opt ProfileSummaryHotCount; +extern cl::opt ProfileSummaryColdCount; + namespace sampleprof { class FunctionSamples; diff --git a/llvm/include/llvm/Transforms/IPO/SampleProfile.h b/llvm/include/llvm/Transforms/IPO/SampleProfile.h index 2ef55949e2365..e94f6ba55cd0d 100644 --- a/llvm/include/llvm/Transforms/IPO/SampleProfile.h +++ b/llvm/include/llvm/Transforms/IPO/SampleProfile.h @@ -17,12 +17,20 @@ #include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/IR/PassManager.h" #include "llvm/Pass.h" +#include "llvm/Support/CommandLine.h" #include namespace llvm { class Module; +extern cl::opt SampleHotCallSiteThreshold; +extern cl::opt SampleColdCallSiteThreshold; +extern cl::opt ProfileInlineGrowthLimit; +extern cl::opt ProfileInlineLimitMin; +extern cl::opt ProfileInlineLimitMax; +extern cl::opt SortProfiledSCC; + namespace vfs { class FileSystem; } // namespace vfs diff --git a/llvm/include/llvm/Transforms/Instrumentation/PGOInstrumentation.h b/llvm/include/llvm/Transforms/Instrumentation/PGOInstrumentation.h index c77d3214ed010..5b1977b7de9a2 100644 --- a/llvm/include/llvm/Transforms/Instrumentation/PGOInstrumentation.h +++ b/llvm/include/llvm/Transforms/Instrumentation/PGOInstrumentation.h @@ -18,11 +18,14 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/IntrusiveRefCntPtr.h" #include "llvm/IR/PassManager.h" +#include "llvm/Support/CommandLine.h" #include #include namespace llvm { +extern cl::opt DebugInfoCorrelate; + class Function; class Instruction; class Module; diff --git a/llvm/lib/Analysis/ProfileSummaryInfo.cpp b/llvm/lib/Analysis/ProfileSummaryInfo.cpp index 203f1e42733f3..fdad14571dfe4 100644 --- a/llvm/lib/Analysis/ProfileSummaryInfo.cpp +++ b/llvm/lib/Analysis/ProfileSummaryInfo.cpp @@ -23,16 +23,6 @@ #include using namespace llvm; -// Knobs for profile summary based thresholds. -namespace llvm { -extern cl::opt ProfileSummaryCutoffHot; -extern cl::opt ProfileSummaryCutoffCold; -extern cl::opt ProfileSummaryHugeWorkingSetSizeThreshold; -extern cl::opt ProfileSummaryLargeWorkingSetSizeThreshold; -extern cl::opt ProfileSummaryHotCount; -extern cl::opt ProfileSummaryColdCount; -} // namespace llvm - static cl::opt PartialProfile( "partial-profile", cl::Hidden, cl::init(false), cl::desc("Specify the current profile is used as a partial profile.")); diff --git a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp index 4464f5399382b..57fcfd5383691 100644 --- a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp +++ b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp @@ -47,6 +47,7 @@ #include "llvm/Support/Error.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/TargetParser/Triple.h" +#include "llvm/Transforms/Instrumentation/PGOInstrumentation.h" #include "llvm/Transforms/Utils/ModuleUtils.h" #include "llvm/Transforms/Utils/SSAUpdater.h" #include diff --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp index 1fe9c57e550a4..7ad1c9bc54f37 100644 --- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp +++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp @@ -327,7 +327,6 @@ extern cl::opt PGOViewCounts; // Defined in Analysis/BlockFrequencyInfo.cpp: -view-bfi-func-name= extern cl::opt ViewBlockFreqFuncName; -extern cl::opt DebugInfoCorrelate; } // namespace llvm static cl::opt diff --git a/llvm/tools/llvm-profgen/CSPreInliner.cpp b/llvm/tools/llvm-profgen/CSPreInliner.cpp index 9421118a3bb1b..e891ea8df4907 100644 --- a/llvm/tools/llvm-profgen/CSPreInliner.cpp +++ b/llvm/tools/llvm-profgen/CSPreInliner.cpp @@ -11,6 +11,7 @@ #include "llvm/ADT/SCCIterator.h" #include "llvm/ADT/Statistic.h" #include "llvm/DebugInfo/Symbolize/SymbolizableModule.h" +#include "llvm/Transforms/IPO/SampleProfile.h" #include #include @@ -35,13 +36,6 @@ STATISTIC( // 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; -extern cl::opt ProfileInlineLimitMin; -extern cl::opt ProfileInlineLimitMax; -extern cl::opt SortProfiledSCC; - cl::opt EnableCSPreInliner( "csspgo-preinliner", cl::Hidden, cl::init(true), cl::desc("Run a global pre-inliner to merge context profile based on "