extern llvm::cl::opt<bool> PGSOColdCodeOnly;
extern llvm::cl::opt<bool> PGSOColdCodeOnlyForInstrPGO;
extern llvm::cl::opt<bool> PGSOColdCodeOnlyForSamplePGO;
+extern llvm::cl::opt<bool> PGSOColdCodeOnlyForPartialSamplePGO;
extern llvm::cl::opt<bool> ForcePGSO;
extern llvm::cl::opt<int> PgsoCutoffInstrProf;
extern llvm::cl::opt<int> PgsoCutoffSampleProf;
Other, // Others.
};
+static inline bool isPGSOColdCodeOnly(ProfileSummaryInfo *PSI) {
+ return PGSOColdCodeOnly ||
+ (PSI->hasInstrumentationProfile() && PGSOColdCodeOnlyForInstrPGO) ||
+ (PSI->hasSampleProfile() &&
+ ((!PSI->hasPartialSampleProfile() && PGSOColdCodeOnlyForSamplePGO) ||
+ (PSI->hasPartialSampleProfile() &&
+ PGSOColdCodeOnlyForPartialSamplePGO))) ||
+ (PGSOLargeWorkingSetSizeOnly && !PSI->hasLargeWorkingSetSize());
+}
+
template<typename AdapterT, typename FuncT, typename BFIT>
bool shouldFuncOptimizeForSizeImpl(const FuncT *F, ProfileSummaryInfo *PSI,
BFIT *BFI, PGSOQueryType QueryType) {
if (PGSOIRPassOrTestOnly && !(QueryType == PGSOQueryType::IRPass ||
QueryType == PGSOQueryType::Test))
return false;
- if (PGSOColdCodeOnly ||
- (PSI->hasInstrumentationProfile() && PGSOColdCodeOnlyForInstrPGO) ||
- (PSI->hasSampleProfile() && PGSOColdCodeOnlyForSamplePGO) ||
- (PGSOLargeWorkingSetSizeOnly && !PSI->hasLargeWorkingSetSize())) {
- // Even if the working set size isn't large, size-optimize cold code.
+ if (isPGSOColdCodeOnly(PSI))
return AdapterT::isFunctionColdInCallGraph(F, PSI, *BFI);
- }
if (PSI->hasSampleProfile())
// The "isCold" check seems to work better for Sample PGO as it could have
// many profile-unannotated functions.
if (PGSOIRPassOrTestOnly && !(QueryType == PGSOQueryType::IRPass ||
QueryType == PGSOQueryType::Test))
return false;
- if (PGSOColdCodeOnly ||
- (PSI->hasInstrumentationProfile() && PGSOColdCodeOnlyForInstrPGO) ||
- (PSI->hasSampleProfile() && PGSOColdCodeOnlyForSamplePGO) ||
- (PGSOLargeWorkingSetSizeOnly && !PSI->hasLargeWorkingSetSize())) {
- // Even if the working set size isn't large, size-optimize cold code.
+ if (isPGSOColdCodeOnly(PSI))
return AdapterT::isColdBlock(BBOrBlockFreq, PSI, BFI);
- }
if (PSI->hasSampleProfile())
// The "isCold" check seems to work better for Sample PGO as it could have
// many profile-unannotated functions.
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(true),
+ 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"
"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."));