diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -69,6 +69,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" @@ -89,8 +90,6 @@ #include "llvm/Support/Extension.def" namespace llvm { -extern cl::opt DebugInfoCorrelate; - // Experiment to move sanitizers earlier. static cl::opt ClSanitizeOnOptimizerEarlyEP( "sanitizer-early-opt-ep", cl::Optional, diff --git a/llvm/include/llvm/ProfileData/ProfileCommon.h b/llvm/include/llvm/ProfileData/ProfileCommon.h --- 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 --- 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 --- 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 --- 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 --- 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 --- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp +++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp @@ -327,7 +327,6 @@ // 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 --- 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 @@ // 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 "