diff options
author | Sanjay Patel <spatel@rotateright.com> | 2017-12-14 22:05:20 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2017-12-14 22:05:20 +0000 |
commit | 0ab0c1a201ece292fdced1f913fa257bdcb5280f (patch) | |
tree | e896fb6f22c7ce9f2106707b0796e7cab2c2c59e /llvm/lib/Passes/PassBuilder.cpp | |
parent | 34ccadcea9eba33d2e410b2af843a3da602611bf (diff) | |
download | bcm5719-llvm-0ab0c1a201ece292fdced1f913fa257bdcb5280f.tar.gz bcm5719-llvm-0ab0c1a201ece292fdced1f913fa257bdcb5280f.zip |
[SimplifyCFG] don't sink common insts too soon (PR34603)
This should solve:
https://bugs.llvm.org/show_bug.cgi?id=34603
...by preventing SimplifyCFG from altering redundant instructions before early-cse has a chance to run.
It changes the default (canonical-forming) behavior of SimplifyCFG, so we're only doing the
sinking transform later in the optimization pipeline.
Differential Revision: https://reviews.llvm.org/D38566
llvm-svn: 320749
Diffstat (limited to 'llvm/lib/Passes/PassBuilder.cpp')
-rw-r--r-- | llvm/lib/Passes/PassBuilder.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp index 56eba691041..d33c4df70c6 100644 --- a/llvm/lib/Passes/PassBuilder.cpp +++ b/llvm/lib/Passes/PassBuilder.cpp @@ -747,21 +747,24 @@ PassBuilder::buildModuleOptimizationPipeline(OptimizationLevel Level, // Cleanup after the loop optimization passes. OptimizePM.addPass(InstCombinePass()); - // Now that we've formed fast to execute loop structures, we do further // optimizations. These are run afterward as they might block doing complex // analyses and transforms such as what are needed for loop vectorization. - // Optimize parallel scalar instruction chains into SIMD instructions. - OptimizePM.addPass(SLPVectorizerPass()); - - // Cleanup after all of the vectorizers. Simplification passes like CVP and + // Cleanup after loop vectorization, etc. Simplification passes like CVP and // GVN, loop transforms, and others have already run, so it's now better to // convert to more optimized IR using more aggressive simplify CFG options. + // The extra sinking transform can create larger basic blocks, so do this + // before SLP vectorization. OptimizePM.addPass(SimplifyCFGPass(SimplifyCFGOptions(). - forwardSwitchCondToPhi(true). - convertSwitchToLookupTable(true). - needCanonicalLoops(false))); + forwardSwitchCondToPhi(true). + convertSwitchToLookupTable(true). + needCanonicalLoops(false). + sinkCommonInsts(true))); + + // Optimize parallel scalar instruction chains into SIMD instructions. + OptimizePM.addPass(SLPVectorizerPass()); + OptimizePM.addPass(InstCombinePass()); // Unroll small loops to hide loop backedge latency and saturate any parallel |