Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rust-lang/llvm
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d9e7d2696e41983b6b5a0b4fac604b4e548a84d3
Choose a base ref
...
head repository: rust-lang/llvm
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: c7a16bd57c2a9c643a52f0cebecdaf0b6a996da1
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Oct 5, 2017

  1. [PassManager] Run global optimizations after the inliner.

    The inliner performs some kind of dead code elimination as it goes,
    but there are cases that are not really caught by it. We might
    at some point consider teaching the inliner about them, but it
    is OK for now to run GlobalOpt + GlobalDCE in tandem as their
    benefits generally outweight the cost, making the whole pipeline
    faster.
    
    This fixes PR34652.
    
    Differential Revision: https://reviews.llvm.org/D38154
    
    git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314997 91177308-0d34-0410-b5e6-96231b3b80d8
    dcci authored and alexcrichton committed Oct 5, 2017
    Copy the full SHA
    1aecec4 View commit details
  2. [PassManager] Improve the interaction between -O2 and ThinLTO.

    Run GDCE slightly later so that we don't have to repeat it
    twice when preparing for Thin. Thanks to Mehdi for the suggestion.
    
    git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314999 91177308-0d34-0410-b5e6-96231b3b80d8
    dcci authored and alexcrichton committed Oct 5, 2017
    Copy the full SHA
    c7a16bd View commit details
Showing with 16 additions and 3 deletions.
  1. +13 −2 lib/Transforms/IPO/PassManagerBuilder.cpp
  2. +3 −1 test/Other/pass-pipelines.ll
15 changes: 13 additions & 2 deletions lib/Transforms/IPO/PassManagerBuilder.cpp
Original file line number Diff line number Diff line change
@@ -475,9 +475,11 @@ void PassManagerBuilder::populateModulePassManager(
// Start of CallGraph SCC passes.
if (!DisableUnitAtATime)
MPM.add(createPruneEHPass()); // Remove dead EH info
bool RunInliner = false;
if (Inliner) {
MPM.add(Inliner);
Inliner = nullptr;
RunInliner = true;
}
if (!DisableUnitAtATime)
MPM.add(createPostOrderFunctionAttrsLegacyPass());
@@ -508,12 +510,21 @@ void PassManagerBuilder::populateModulePassManager(
if (!DisableUnitAtATime)
MPM.add(createReversePostOrderFunctionAttrsPass());

// The inliner performs some kind of dead code elimination as it goes,
// but there are cases that are not really caught by it. We might
// at some point consider teaching the inliner about them, but it
// is OK for now to run GlobalOpt + GlobalDCE in tandem as their
// benefits generally outweight the cost, making the whole pipeline
// faster.
if (RunInliner) {
MPM.add(createGlobalOptimizerPass());
MPM.add(createGlobalDCEPass());
}

// If we are planning to perform ThinLTO later, let's not bloat the code with
// unrolling/vectorization/... now. We'll first run the inliner + CGSCC passes
// during ThinLTO and perform the rest of the optimizations afterward.
if (PrepareForThinLTO) {
// Reduce the size of the IR as much as possible.
MPM.add(createGlobalOptimizerPass());
// Rename anon globals to be able to export them in the summary.
MPM.add(createNameAnonGlobalPass());
return;
4 changes: 3 additions & 1 deletion test/Other/pass-pipelines.ll
Original file line number Diff line number Diff line change
@@ -55,13 +55,15 @@
; Next we break out of the main Function passes inside the CGSCC pipeline with
; a barrier pass.
; CHECK-O2: A No-Op Barrier Pass
; Reduce the size of the IR ASAP after the inliner.
; CHECK-O2-NEXT: Eliminate Available Externally
; Inferring function attribute should be right after the CGSCC pipeline, before
; any other optimizations/analyses.
; CHECK-O2-NEXT: CallGraph
; CHECK-O2-NEXT: Deduce function attributes in RPO
; CHECK-O2-NOT: Manager
; Reduce the size of the IR ASAP after the inliner.
; CHECK-O2-NEXT: Global Variable Optimizer
; CHECK-O2: Dead Global Elimination
; Next is the late function pass pipeline.
; CHECK-O2: FunctionPass Manager
; CHECK-O2-NOT: Manager