diff options
author | Easwaran Raman <eraman@google.com> | 2017-05-04 16:58:45 +0000 |
---|---|---|
committer | Easwaran Raman <eraman@google.com> | 2017-05-04 16:58:45 +0000 |
commit | 5e6f9bd4f8d7361ab16d437274d338750f16e1b8 (patch) | |
tree | ecddc771698a70ddf77efc1195b35550abae5b17 | |
parent | 4a4875628f8bc329a437f9e68fe545f430ef9ae9 (diff) | |
download | bcm5719-llvm-5e6f9bd4f8d7361ab16d437274d338750f16e1b8.tar.gz bcm5719-llvm-5e6f9bd4f8d7361ab16d437274d338750f16e1b8.zip |
[PM] Add ProfileSummaryAnalysis as a required pass in the new pipeline.
Differential revision: https://reviews.llvm.org/D32768
llvm-svn: 302170
-rw-r--r-- | llvm/lib/Passes/PassBuilder.cpp | 4 | ||||
-rw-r--r-- | llvm/test/Other/new-pm-defaults.ll | 2 | ||||
-rw-r--r-- | llvm/test/Transforms/Inline/inline-hot-callsite.ll | 12 |
3 files changed, 15 insertions, 3 deletions
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp index 8db65f7f0e8..7076e751071 100644 --- a/llvm/lib/Passes/PassBuilder.cpp +++ b/llvm/lib/Passes/PassBuilder.cpp @@ -505,6 +505,10 @@ PassBuilder::buildPerModuleDefaultPipeline(OptimizationLevel Level, // 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 diff --git a/llvm/test/Other/new-pm-defaults.ll b/llvm/test/Other/new-pm-defaults.ll index a4a1c1f546c..f712dc7b63c 100644 --- a/llvm/test/Other/new-pm-defaults.ll +++ b/llvm/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 diff --git a/llvm/test/Transforms/Inline/inline-hot-callsite.ll b/llvm/test/Transforms/Inline/inline-hot-callsite.ll index ebf4030d3d1..48fa3039741 100644 --- a/llvm/test/Transforms/Inline/inline-hot-callsite.ll +++ b/llvm/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 @@ define i32 @callee2(i32 %x) { %x2 = add i32 %x1, 1 %x3 = add i32 %x2, 1 call void @extern() + call void @extern() ret i32 %x3 } |