Skip to content

Commit 3f0969d

Browse files
committed
[PGO][PGSO] Temporarily disable the large working set size behavior.
Summary: This temporarily disables the large working set size behavior in profile guided size optimization due to internal benchmark regressions. Reviewers: davidxl Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D70207
1 parent d94f637 commit 3f0969d

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

llvm/include/llvm/Transforms/Utils/SizeOpts.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ using namespace llvm;
2121

2222
extern cl::opt<bool> EnablePGSO;
2323
extern cl::opt<bool> PGSOLargeWorkingSetSizeOnly;
24+
extern cl::opt<bool> PGSOColdCodeOnly;
2425
extern cl::opt<bool> ForcePGSO;
2526
extern cl::opt<int> PgsoCutoffInstrProf;
2627
extern cl::opt<int> PgsoCutoffSampleProf;
@@ -42,7 +43,8 @@ bool shouldFuncOptimizeForSizeImpl(const FuncT *F, ProfileSummaryInfo *PSI,
4243
return true;
4344
if (!EnablePGSO)
4445
return false;
45-
if (PGSOLargeWorkingSetSizeOnly && !PSI->hasLargeWorkingSetSize()) {
46+
if (PGSOColdCodeOnly ||
47+
(PGSOLargeWorkingSetSizeOnly && !PSI->hasLargeWorkingSetSize())) {
4648
// Even if the working set size isn't large, size-optimize cold code.
4749
return AdapterT::isFunctionColdInCallGraph(F, PSI, *BFI);
4850
}
@@ -61,7 +63,8 @@ bool shouldOptimizeForSizeImpl(const BlockT *BB, ProfileSummaryInfo *PSI,
6163
return true;
6264
if (!EnablePGSO)
6365
return false;
64-
if (PGSOLargeWorkingSetSizeOnly && !PSI->hasLargeWorkingSetSize()) {
66+
if (PGSOColdCodeOnly ||
67+
(PGSOLargeWorkingSetSizeOnly && !PSI->hasLargeWorkingSetSize())) {
6568
// Even if the working set size isn't large, size-optimize cold code.
6669
return AdapterT::isColdBlock(BB, PSI, BFI);
6770
}

llvm/lib/Transforms/Utils/SizeOpts.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ cl::opt<bool> PGSOLargeWorkingSetSizeOnly(
2323
cl::desc("Apply the profile guided size optimizations only "
2424
"if the working set size is large (except for cold code.)"));
2525

26+
cl::opt<bool> PGSOColdCodeOnly(
27+
"pgso-cold-code-only", cl::Hidden, cl::init(true),
28+
cl::desc("Apply the profile guided size optimizations only "
29+
"to cold code."));
30+
2631
cl::opt<bool> ForcePGSO(
2732
"force-pgso", cl::Hidden, cl::init(false),
2833
cl::desc("Force the (profiled-guided) size optimizations. "));

0 commit comments

Comments
 (0)