[PATCH] D91826: [PGO] Make -disable-preinline work with NPM

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 19 14:41:16 PST 2020


aeubanks created this revision.
aeubanks added a reviewer: xur.
Herald added subscribers: llvm-commits, wenlei, hiraditya.
Herald added a project: LLVM.
aeubanks requested review of this revision.

Fixes cspgo_profile_summary.ll under NPM.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91826

Files:
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
  llvm/test/Transforms/PGOProfile/cspgo_profile_summary.ll


Index: llvm/test/Transforms/PGOProfile/cspgo_profile_summary.ll
===================================================================
--- llvm/test/Transforms/PGOProfile/cspgo_profile_summary.ll
+++ llvm/test/Transforms/PGOProfile/cspgo_profile_summary.ll
@@ -1,6 +1,7 @@
 ; Test the profile summary for context sensitive PGO (CSPGO)
 
 ; RUN: llvm-profdata merge %S/Inputs/cspgo.proftext -o %t.profdata
+; RUN: opt < %s -passes='default<O2>' -disable-preinline -pgo-instrument-entry=false -pgo-kind=pgo-instr-use-pipeline -profile-file=%t.profdata -S | FileCheck %s --check-prefix=PGOSUMMARY
 ; RUN: opt < %s -O2 -disable-preinline -pgo-instrument-entry=false -pgo-kind=pgo-instr-use-pipeline -profile-file=%t.profdata -S | FileCheck %s --check-prefix=PGOSUMMARY
 ; RUN: opt < %s -O2 -disable-preinline -pgo-instrument-entry=false -pgo-kind=pgo-instr-use-pipeline -profile-file=%t.profdata -S -cspgo-kind=cspgo-instr-use-pipeline| FileCheck %s --check-prefix=CSPGOSUMMARY
 
Index: llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
===================================================================
--- llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
+++ llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
@@ -111,7 +111,7 @@
     "enable-loop-versioning-licm", cl::init(false), cl::Hidden,
     cl::desc("Enable the experimental Loop Versioning LICM pass"));
 
-static cl::opt<bool>
+cl::opt<bool>
     DisablePreInliner("disable-preinline", cl::init(false), cl::Hidden,
                       cl::desc("Disable pre-instrumentation inliner"));
 
Index: llvm/lib/Passes/PassBuilder.cpp
===================================================================
--- llvm/lib/Passes/PassBuilder.cpp
+++ llvm/lib/Passes/PassBuilder.cpp
@@ -322,6 +322,8 @@
 
 extern cl::opt<bool> EnableMatrix;
 
+extern cl::opt<bool> DisablePreInliner;
+
 const PassBuilder::OptimizationLevel PassBuilder::OptimizationLevel::O0 = {
     /*SpeedLevel*/ 0,
     /*SizeLevel*/ 0};
@@ -822,7 +824,7 @@
   // the size grows, so let's be conservative here and skip this simplification
   // at -Os/Oz. We will not do this  inline for context sensistive PGO (when
   // IsCS is true).
-  if (!Level.isOptimizingForSize() && !IsCS) {
+  if (!Level.isOptimizingForSize() && !IsCS && !DisablePreInliner) {
     InlineParams IP;
 
     IP.DefaultThreshold = PreInlineThreshold;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91826.306541.patch
Type: text/x-patch
Size: 2332 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201119/867058af/attachment.bin>


More information about the llvm-commits mailing list