[PATCH] D32768: [PM] Add ProfileSummaryAnalysis as a required pass in the new pipeline.

Easwaran Raman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 4 10:11:49 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL302170: [PM] Add ProfileSummaryAnalysis as a required pass in the new pipeline. (authored by eraman).

Changed prior to commit:
  https://reviews.llvm.org/D32768?vs=97756&id=97846#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D32768

Files:
  llvm/trunk/lib/Passes/PassBuilder.cpp
  llvm/trunk/test/Other/new-pm-defaults.ll
  llvm/trunk/test/Transforms/Inline/inline-hot-callsite.ll


Index: llvm/trunk/test/Transforms/Inline/inline-hot-callsite.ll
===================================================================
--- llvm/trunk/test/Transforms/Inline/inline-hot-callsite.ll
+++ llvm/trunk/test/Transforms/Inline/inline-hot-callsite.ll
@@ -1,16 +1,21 @@
-; RUN: opt < %s -inline -inline-threshold=0 -hot-callsite-threshold=100 -S | FileCheck %s
-; RUN: opt < %s -passes='require<profile-summary>,cgscc(inline)' -inline-threshold=0 -hot-callsite-threshold=100 -S | FileCheck %s
-
 ; This tests that a hot callsite gets the (higher) inlinehint-threshold even without
 ; without inline hints and gets inlined because the cost is less than
 ; inlinehint-threshold. A cold callee with identical body does not get inlined because
 ; cost exceeds the inline-threshold
 
+; RUN: opt < %s -inline -inline-threshold=0 -hot-callsite-threshold=100 -S | FileCheck %s
+; RUN: opt < %s -passes='require<profile-summary>,cgscc(inline)' -inline-threshold=0 -hot-callsite-threshold=100 -S | FileCheck %s
+
+; Run this with the default O2 pipeline to test that profile summary analysis
+; is available during inlining.
+; RUN: opt < %s -passes='default<O2>' -inline-threshold=0 -hot-callsite-threshold=100 -S | FileCheck %s
+
 define i32 @callee1(i32 %x) {
   %x1 = add i32 %x, 1
   %x2 = add i32 %x1, 1
   %x3 = add i32 %x2, 1
   call void @extern()
+  call void @extern()
   ret i32 %x3
 }
 
@@ -20,6 +25,7 @@
   %x2 = add i32 %x1, 1
   %x3 = add i32 %x2, 1
   call void @extern()
+  call void @extern()
   ret i32 %x3
 }
 
Index: llvm/trunk/test/Other/new-pm-defaults.ll
===================================================================
--- llvm/trunk/test/Other/new-pm-defaults.ll
+++ llvm/trunk/test/Other/new-pm-defaults.ll
@@ -57,6 +57,8 @@
 ; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}GlobalsAA
 ; CHECK-O-NEXT: Running analysis: GlobalsAA
 ; CHECK-O-NEXT: Running analysis: CallGraphAnalysis
+; CHECK-O-NEXT: Running pass: RequireAnalysisPass<{{.*}}ProfileSummaryAnalysis
+; CHECK-O-NEXT: Running analysis: ProfileSummaryAnalysis
 ; CHECK-O-NEXT: Running pass: ModuleToPostOrderCGSCCPassAdaptor<{{.*}}LazyCallGraph{{.*}}>
 ; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy
 ; CHECK-O-NEXT: Running analysis: LazyCallGraphAnalysis
Index: llvm/trunk/lib/Passes/PassBuilder.cpp
===================================================================
--- llvm/trunk/lib/Passes/PassBuilder.cpp
+++ llvm/trunk/lib/Passes/PassBuilder.cpp
@@ -505,6 +505,10 @@
   // the CGSCC pipeline.
   MPM.addPass(RequireAnalysisPass<GlobalsAA, Module>());
 
+  // Require the ProfileSummaryAnalysis for the module so we can query it within
+  // the inliner pass.
+  MPM.addPass(RequireAnalysisPass<ProfileSummaryAnalysis, Module>());
+
   // Now begin the main postorder CGSCC pipeline.
   // FIXME: The current CGSCC pipeline has its origins in the legacy pass
   // manager and trying to emulate its precise behavior. Much of this doesn't


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32768.97846.patch
Type: text/x-patch
Size: 2950 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170504/38237145/attachment.bin>


More information about the llvm-commits mailing list