LTO: respect command-line options that disable vectorization.
authorJF Bastien <jfb@google.com>
Tue, 21 Oct 2014 23:18:21 +0000 (23:18 +0000)
committerJF Bastien <jfb@google.com>
Tue, 21 Oct 2014 23:18:21 +0000 (23:18 +0000)
Summary: Patches 202051 and 208013 added calls to LTO's PassManager which unconditionally add LoopVectorizePass and SLPVectorizerPass instead of following the logic in PassManagerBuilder::populateModulePassManager and honoring the -vectorize-loops -run-slp-after-loop-vectorization flags.

Reviewers: nadav, aschwaighofer, yijiang

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D5884

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220345 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/PassManagerBuilder.cpp

index 877fc712ec74f6fae71afb708d126633caa66e72..4e048b7e91a57c938d5b9eeeeffc717dd9deaa13 100644 (file)
@@ -440,10 +440,12 @@ void PassManagerBuilder::addLTOOptimizationPasses(PassManagerBase &PM) {
   // More loops are countable; try to optimize them.
   PM.add(createIndVarSimplifyPass());
   PM.add(createLoopDeletionPass());
   // More loops are countable; try to optimize them.
   PM.add(createIndVarSimplifyPass());
   PM.add(createLoopDeletionPass());
-  PM.add(createLoopVectorizePass(true, true));
+  PM.add(createLoopVectorizePass(DisableUnrollLoops, LoopVectorize));
 
   // More scalar chains could be vectorized due to more alias information
 
   // More scalar chains could be vectorized due to more alias information
-  PM.add(createSLPVectorizerPass()); // Vectorize parallel scalar chains.
+  if (RunSLPAfterLoopVectorization)
+    if (SLPVectorize)
+      PM.add(createSLPVectorizerPass()); // Vectorize parallel scalar chains.
 
   // After vectorization, assume intrinsics may tell us more about pointer
   // alignments.
 
   // After vectorization, assume intrinsics may tell us more about pointer
   // alignments.