Skip to content

Commit e7247f1

Browse files
committed
[profiling] Move option declarations into headers
This will make it possible to add visibility attributes to these variables. This also fixes some type mismatches between the declaration and the definition. Reviewed By: bogner, huangjd Differential Revision: https://reviews.llvm.org/D156599
1 parent b225f2d commit e7247f1

File tree

8 files changed

+22
-19
lines changed

8 files changed

+22
-19
lines changed

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
#include "llvm/Transforms/Instrumentation/KCFI.h"
7171
#include "llvm/Transforms/Instrumentation/MemProfiler.h"
7272
#include "llvm/Transforms/Instrumentation/MemorySanitizer.h"
73+
#include "llvm/Transforms/Instrumentation/PGOInstrumentation.h"
7374
#include "llvm/Transforms/Instrumentation/SanitizerBinaryMetadata.h"
7475
#include "llvm/Transforms/Instrumentation/SanitizerCoverage.h"
7576
#include "llvm/Transforms/Instrumentation/ThreadSanitizer.h"
@@ -90,7 +91,6 @@ using namespace llvm;
9091
#include "llvm/Support/Extension.def"
9192

9293
namespace llvm {
93-
extern cl::opt<bool> DebugInfoCorrelate;
9494
extern cl::opt<bool> PrintPipelinePasses;
9595

9696
// Experiment to move sanitizers earlier.

llvm/include/llvm/ProfileData/ProfileCommon.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@
2828

2929
namespace llvm {
3030

31+
extern cl::opt<bool> UseContextLessSummary;
32+
extern cl::opt<int> ProfileSummaryCutoffHot;
33+
extern cl::opt<int> ProfileSummaryCutoffCold;
34+
extern cl::opt<unsigned> ProfileSummaryHugeWorkingSetSizeThreshold;
35+
extern cl::opt<unsigned> ProfileSummaryLargeWorkingSetSizeThreshold;
36+
extern cl::opt<uint64_t> ProfileSummaryHotCount;
37+
extern cl::opt<uint64_t> ProfileSummaryColdCount;
38+
3139
namespace sampleprof {
3240

3341
class FunctionSamples;

llvm/include/llvm/Transforms/IPO/SampleProfile.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,20 @@
1717
#include "llvm/ADT/IntrusiveRefCntPtr.h"
1818
#include "llvm/IR/PassManager.h"
1919
#include "llvm/Pass.h"
20+
#include "llvm/Support/CommandLine.h"
2021
#include <string>
2122

2223
namespace llvm {
2324

2425
class Module;
2526

27+
extern cl::opt<int> SampleHotCallSiteThreshold;
28+
extern cl::opt<int> SampleColdCallSiteThreshold;
29+
extern cl::opt<int> ProfileInlineGrowthLimit;
30+
extern cl::opt<int> ProfileInlineLimitMin;
31+
extern cl::opt<int> ProfileInlineLimitMax;
32+
extern cl::opt<bool> SortProfiledSCC;
33+
2634
namespace vfs {
2735
class FileSystem;
2836
} // namespace vfs

llvm/include/llvm/Transforms/Instrumentation/PGOInstrumentation.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@
1818
#include "llvm/ADT/ArrayRef.h"
1919
#include "llvm/ADT/IntrusiveRefCntPtr.h"
2020
#include "llvm/IR/PassManager.h"
21+
#include "llvm/Support/CommandLine.h"
2122
#include <cstdint>
2223
#include <string>
2324

2425
namespace llvm {
2526

27+
extern cl::opt<bool> DebugInfoCorrelate;
28+
2629
class Function;
2730
class Instruction;
2831
class Module;

llvm/lib/Analysis/ProfileSummaryInfo.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,6 @@
2323
#include <optional>
2424
using namespace llvm;
2525

26-
// Knobs for profile summary based thresholds.
27-
namespace llvm {
28-
extern cl::opt<int> ProfileSummaryCutoffHot;
29-
extern cl::opt<int> ProfileSummaryCutoffCold;
30-
extern cl::opt<unsigned> ProfileSummaryHugeWorkingSetSizeThreshold;
31-
extern cl::opt<unsigned> ProfileSummaryLargeWorkingSetSizeThreshold;
32-
extern cl::opt<int> ProfileSummaryHotCount;
33-
extern cl::opt<int> ProfileSummaryColdCount;
34-
} // namespace llvm
35-
3626
static cl::opt<bool> PartialProfile(
3727
"partial-profile", cl::Hidden, cl::init(false),
3828
cl::desc("Specify the current profile is used as a partial profile."));

llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
#include "llvm/Support/Error.h"
4848
#include "llvm/Support/ErrorHandling.h"
4949
#include "llvm/TargetParser/Triple.h"
50+
#include "llvm/Transforms/Instrumentation/PGOInstrumentation.h"
5051
#include "llvm/Transforms/Utils/ModuleUtils.h"
5152
#include "llvm/Transforms/Utils/SSAUpdater.h"
5253
#include <algorithm>

llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,6 @@ extern cl::opt<PGOViewCountsType> PGOViewCounts;
327327
// Defined in Analysis/BlockFrequencyInfo.cpp: -view-bfi-func-name=
328328
extern cl::opt<std::string> ViewBlockFreqFuncName;
329329

330-
extern cl::opt<bool> DebugInfoCorrelate;
331330
} // namespace llvm
332331

333332
static cl::opt<bool>

llvm/tools/llvm-profgen/CSPreInliner.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "llvm/ADT/SCCIterator.h"
1212
#include "llvm/ADT/Statistic.h"
1313
#include "llvm/DebugInfo/Symbolize/SymbolizableModule.h"
14+
#include "llvm/Transforms/IPO/SampleProfile.h"
1415
#include <cstdint>
1516
#include <queue>
1617

@@ -35,13 +36,6 @@ STATISTIC(
3536
// TODO: the actual threshold to be tuned here because the size here is based
3637
// on machine code not LLVM IR.
3738
namespace llvm {
38-
extern cl::opt<int> SampleHotCallSiteThreshold;
39-
extern cl::opt<int> SampleColdCallSiteThreshold;
40-
extern cl::opt<int> ProfileInlineGrowthLimit;
41-
extern cl::opt<int> ProfileInlineLimitMin;
42-
extern cl::opt<int> ProfileInlineLimitMax;
43-
extern cl::opt<bool> SortProfiledSCC;
44-
4539
cl::opt<bool> EnableCSPreInliner(
4640
"csspgo-preinliner", cl::Hidden, cl::init(true),
4741
cl::desc("Run a global pre-inliner to merge context profile based on "

0 commit comments

Comments
 (0)