[PATCH] D72937: [PGO][PGSO] Tune flags for profile guided size optimization.
Hiroshi Yamauchi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 4 10:49:33 PST 2020
yamauchi updated this revision to Diff 242375.
yamauchi added a comment.
Rebase. PTAL.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D72937/new/
https://reviews.llvm.org/D72937
Files:
llvm/include/llvm/Transforms/Utils/SizeOpts.h
llvm/lib/Transforms/Utils/SizeOpts.cpp
Index: llvm/lib/Transforms/Utils/SizeOpts.cpp
===================================================================
--- llvm/lib/Transforms/Utils/SizeOpts.cpp
+++ llvm/lib/Transforms/Utils/SizeOpts.cpp
@@ -28,6 +28,16 @@
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(true),
+ 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(true),
+ cl::desc("Apply the profile guided size optimizations only "
+ "to cold code under 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,7 +48,7 @@
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."));
Index: llvm/include/llvm/Transforms/Utils/SizeOpts.h
===================================================================
--- llvm/include/llvm/Transforms/Utils/SizeOpts.h
+++ llvm/include/llvm/Transforms/Utils/SizeOpts.h
@@ -21,6 +21,8 @@
extern llvm::cl::opt<bool> PGSOLargeWorkingSetSizeOnly;
extern llvm::cl::opt<bool> PGSOIRPassOrTestOnly;
extern llvm::cl::opt<bool> PGSOColdCodeOnly;
+extern llvm::cl::opt<bool> PGSOColdCodeOnlyForInstrPGO;
+extern llvm::cl::opt<bool> PGSOColdCodeOnlyForSamplePGO;
extern llvm::cl::opt<bool> ForcePGSO;
extern llvm::cl::opt<int> PgsoCutoffInstrProf;
extern llvm::cl::opt<int> PgsoCutoffSampleProf;
@@ -54,6 +56,8 @@
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.
return AdapterT::isFunctionColdInCallGraph(F, PSI, *BFI);
@@ -78,6 +82,8 @@
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.
return AdapterT::isColdBlock(BBOrBlockFreq, PSI, BFI);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72937.242375.patch
Type: text/x-patch
Size: 2980 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200204/c87bf7b8/attachment.bin>
More information about the llvm-commits
mailing list