[llvm] 3f0969d - [PGO][PGSO] Temporarily disable the large working set size behavior.

Hiroshi Yamauchi via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 13 14:01:36 PST 2019


Author: Hiroshi Yamauchi
Date: 2019-11-13T14:00:47-08:00
New Revision: 3f0969daf9d0addc4d41a57b4a10f753f5397a5e

URL: https://github.com/llvm/llvm-project/commit/3f0969daf9d0addc4d41a57b4a10f753f5397a5e
DIFF: https://github.com/llvm/llvm-project/commit/3f0969daf9d0addc4d41a57b4a10f753f5397a5e.diff

LOG: [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

Added: 
    

Modified: 
    llvm/include/llvm/Transforms/Utils/SizeOpts.h
    llvm/lib/Transforms/Utils/SizeOpts.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Transforms/Utils/SizeOpts.h b/llvm/include/llvm/Transforms/Utils/SizeOpts.h
index 1c56da08ef8b..4614007a6458 100644
--- a/llvm/include/llvm/Transforms/Utils/SizeOpts.h
+++ b/llvm/include/llvm/Transforms/Utils/SizeOpts.h
@@ -21,6 +21,7 @@ using namespace llvm;
 
 extern cl::opt<bool> EnablePGSO;
 extern cl::opt<bool> PGSOLargeWorkingSetSizeOnly;
+extern cl::opt<bool> PGSOColdCodeOnly;
 extern cl::opt<bool> ForcePGSO;
 extern cl::opt<int> PgsoCutoffInstrProf;
 extern cl::opt<int> PgsoCutoffSampleProf;
@@ -42,7 +43,8 @@ bool shouldFuncOptimizeForSizeImpl(const FuncT *F, ProfileSummaryInfo *PSI,
     return true;
   if (!EnablePGSO)
     return false;
-  if (PGSOLargeWorkingSetSizeOnly && !PSI->hasLargeWorkingSetSize()) {
+  if (PGSOColdCodeOnly ||
+      (PGSOLargeWorkingSetSizeOnly && !PSI->hasLargeWorkingSetSize())) {
     // Even if the working set size isn't large, size-optimize cold code.
     return AdapterT::isFunctionColdInCallGraph(F, PSI, *BFI);
   }
@@ -61,7 +63,8 @@ bool shouldOptimizeForSizeImpl(const BlockT *BB, ProfileSummaryInfo *PSI,
     return true;
   if (!EnablePGSO)
     return false;
-  if (PGSOLargeWorkingSetSizeOnly && !PSI->hasLargeWorkingSetSize()) {
+  if (PGSOColdCodeOnly ||
+      (PGSOLargeWorkingSetSizeOnly && !PSI->hasLargeWorkingSetSize())) {
     // Even if the working set size isn't large, size-optimize cold code.
     return AdapterT::isColdBlock(BB, PSI, BFI);
   }

diff  --git a/llvm/lib/Transforms/Utils/SizeOpts.cpp b/llvm/lib/Transforms/Utils/SizeOpts.cpp
index f819c67d69d0..f1200471cb4f 100644
--- a/llvm/lib/Transforms/Utils/SizeOpts.cpp
+++ b/llvm/lib/Transforms/Utils/SizeOpts.cpp
@@ -23,6 +23,11 @@ cl::opt<bool> PGSOLargeWorkingSetSizeOnly(
     cl::desc("Apply the profile guided size optimizations only "
              "if the working set size is large (except for cold code.)"));
 
+cl::opt<bool> PGSOColdCodeOnly(
+    "pgso-cold-code-only", cl::Hidden, cl::init(true),
+    cl::desc("Apply the profile guided size optimizations only "
+             "to cold code."));
+
 cl::opt<bool> ForcePGSO(
     "force-pgso", cl::Hidden, cl::init(false),
     cl::desc("Force the (profiled-guided) size optimizations. "));


        


More information about the llvm-commits mailing list