diff options
Diffstat (limited to 'llvm/lib/Transforms/Utils/SizeOpts.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/SizeOpts.cpp | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/SizeOpts.cpp b/llvm/lib/Transforms/Utils/SizeOpts.cpp index d2a400027d4b..e257c5a015f5 100644 --- a/llvm/lib/Transforms/Utils/SizeOpts.cpp +++ b/llvm/lib/Transforms/Utils/SizeOpts.cpp @@ -24,10 +24,25 @@ cl::opt<bool> PGSOLargeWorkingSetSizeOnly( "if the working set size is large (except for cold code.)")); cl::opt<bool> PGSOColdCodeOnly( - "pgso-cold-code-only", cl::Hidden, cl::init(true), + "pgso-cold-code-only", cl::Hidden, cl::init(false), cl::desc("Apply the profile guided size optimizations only " "to cold code.")); +cl::opt<bool> PGSOColdCodeOnlyForInstrPGO( + "pgso-cold-code-only-for-instr-pgo", cl::Hidden, cl::init(false), + cl::desc("Apply the profile guided size optimizations only " + "to cold code under instrumentation PGO.")); + +cl::opt<bool> PGSOColdCodeOnlyForSamplePGO( + "pgso-cold-code-only-for-sample-pgo", cl::Hidden, cl::init(false), + cl::desc("Apply the profile guided size optimizations only " + "to cold code under sample PGO.")); + +cl::opt<bool> PGSOColdCodeOnlyForPartialSamplePGO( + "pgso-cold-code-only-for-partial-sample-pgo", cl::Hidden, cl::init(false), + cl::desc("Apply the profile guided size optimizations only " + "to cold code under partial-profile sample PGO.")); + cl::opt<bool> PGSOIRPassOrTestOnly( "pgso-ir-pass-or-test-only", cl::Hidden, cl::init(false), cl::desc("Apply the profile guided size optimizations only" @@ -38,12 +53,12 @@ cl::opt<bool> ForcePGSO( cl::desc("Force the (profiled-guided) size optimizations. ")); cl::opt<int> PgsoCutoffInstrProf( - "pgso-cutoff-instr-prof", cl::Hidden, cl::init(250000), cl::ZeroOrMore, + "pgso-cutoff-instr-prof", cl::Hidden, cl::init(950000), cl::ZeroOrMore, cl::desc("The profile guided size optimization profile summary cutoff " "for instrumentation profile.")); cl::opt<int> PgsoCutoffSampleProf( - "pgso-cutoff-sample-prof", cl::Hidden, cl::init(800000), cl::ZeroOrMore, + "pgso-cutoff-sample-prof", cl::Hidden, cl::init(990000), cl::ZeroOrMore, cl::desc("The profile guided size optimization profile summary cutoff " "for sample profile.")); @@ -60,6 +75,12 @@ struct BasicBlockBFIAdapter { BlockFrequencyInfo &BFI) { return PSI->isFunctionHotInCallGraphNthPercentile(CutOff, F, BFI); } + static bool isFunctionColdInCallGraphNthPercentile(int CutOff, + const Function *F, + ProfileSummaryInfo *PSI, + BlockFrequencyInfo &BFI) { + return PSI->isFunctionColdInCallGraphNthPercentile(CutOff, F, BFI); + } static bool isColdBlock(const BasicBlock *BB, ProfileSummaryInfo *PSI, BlockFrequencyInfo *BFI) { @@ -71,6 +92,11 @@ struct BasicBlockBFIAdapter { BlockFrequencyInfo *BFI) { return PSI->isHotBlockNthPercentile(CutOff, BB, BFI); } + static bool isColdBlockNthPercentile(int CutOff, const BasicBlock *BB, + ProfileSummaryInfo *PSI, + BlockFrequencyInfo *BFI) { + return PSI->isColdBlockNthPercentile(CutOff, BB, BFI); + } }; } // end anonymous namespace @@ -84,6 +110,7 @@ bool llvm::shouldOptimizeForSize(const Function *F, ProfileSummaryInfo *PSI, bool llvm::shouldOptimizeForSize(const BasicBlock *BB, ProfileSummaryInfo *PSI, BlockFrequencyInfo *BFI, PGSOQueryType QueryType) { + assert(BB); return shouldOptimizeForSizeImpl<BasicBlockBFIAdapter>(BB, PSI, BFI, QueryType); } |