]> granicus.if.org Git - llvm/commitdiff
[NewPassManager] Add tuning option: SLPVectorization [NFC].
authorAlina Sbirlea <asbirlea@google.com>
Wed, 8 May 2019 17:58:35 +0000 (17:58 +0000)
committerAlina Sbirlea <asbirlea@google.com>
Wed, 8 May 2019 17:58:35 +0000 (17:58 +0000)
Summary: Mirror tuning option from old pass manager in new pass manager.

Reviewers: chandlerc

Subscribers: mehdi_amini, jlebar, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D61616

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

include/llvm/Passes/PassBuilder.h
include/llvm/Transforms/Vectorize/SLPVectorizer.h
lib/Passes/PassBuilder.cpp
lib/Transforms/IPO/PassManagerBuilder.cpp
lib/Transforms/Vectorize/SLPVectorizer.cpp

index 1218761082c5ae45569653d9731df04d2a992b8f..1f81181c636dfbb1dcd080d539117d3f69545f7a 100644 (file)
@@ -81,6 +81,10 @@ public:
   /// that of the flag: `-vectorize-loops`.
   bool LoopVectorization;
 
+  /// Tuning option to enable/disable slp loop vectorization. Its default value
+  /// is that of the flag: `vectorize-slp`.
+  bool SLPVectorization;
+
   /// Tuning option to cap the number of calls to retrive clobbering accesses in
   /// MemorySSA, in LICM.
   unsigned LicmMssaOptCap;
index 9be70557b5b9ece3135f73c37970ba3130f34179..ac6afb761d4d53b5b2ae49087dbf35a38d94f341 100644 (file)
@@ -55,6 +55,8 @@ class BoUpSLP;
 
 } // end namespace slpvectorizer
 
+extern cl::opt<bool> RunSLPVectorization;
+
 struct SLPVectorizerPass : public PassInfoMixin<SLPVectorizerPass> {
   using StoreList = SmallVector<StoreInst *, 8>;
   using StoreListMap = MapVector<Value *, StoreList>;
index f8c62a876ff16a31e07dc0915afd1f3441729dfd..89b9c520af83738da722da9f8929d4ba3cfa1ead 100644 (file)
@@ -214,6 +214,7 @@ static cl::opt<bool>
 PipelineTuningOptions::PipelineTuningOptions() {
   LoopInterleaving = EnableLoopInterleaving;
   LoopVectorization = EnableLoopVectorization;
+  SLPVectorization = RunSLPVectorization;
   LicmMssaOptCap = SetLicmMssaOptCap;
   LicmMssaNoAccForPromotionCap = SetLicmMssaNoAccForPromotionCap;
 }
@@ -888,7 +889,8 @@ ModulePassManager PassBuilder::buildModuleOptimizationPipeline(
                                      sinkCommonInsts(true)));
 
   // Optimize parallel scalar instruction chains into SIMD instructions.
-  OptimizePM.addPass(SLPVectorizerPass());
+  if (PTO.SLPVectorization)
+    OptimizePM.addPass(SLPVectorizerPass());
 
   OptimizePM.addPass(InstCombinePass());
 
index e8b4b8fe75bfff263e1640e5c169fde8757696dc..298cf47ed83b39b08fa5ee5d2ed7126c4ccd7e84 100644 (file)
@@ -43,6 +43,7 @@
 #include "llvm/Transforms/Utils.h"
 #include "llvm/Transforms/Vectorize.h"
 #include "llvm/Transforms/Vectorize/LoopVectorize.h"
+#include "llvm/Transforms/Vectorize/SLPVectorizer.h"
 
 using namespace llvm;
 
@@ -50,10 +51,6 @@ static cl::opt<bool>
     RunPartialInlining("enable-partial-inlining", cl::init(false), cl::Hidden,
                        cl::ZeroOrMore, cl::desc("Run Partial inlinining pass"));
 
-static cl::opt<bool>
-RunSLPVectorization("vectorize-slp", cl::Hidden,
-                    cl::desc("Run the SLP vectorization passes"));
-
 static cl::opt<bool>
 UseGVNAfterVectorization("use-gvn-after-vectorization",
   cl::init(false), cl::Hidden,
index ff9a2d2bf776e8b8b598cec55d052d868aad1fb1..f350db5c5fca1e47411c8bb1b0354f3516d4fb8c 100644 (file)
@@ -105,6 +105,10 @@ using namespace slpvectorizer;
 
 STATISTIC(NumVectorInstructions, "Number of vector instructions generated");
 
+cl::opt<bool>
+    llvm::RunSLPVectorization("vectorize-slp", cl::init(true), cl::Hidden,
+                              cl::desc("Run the SLP vectorization passes"));
+
 static cl::opt<int>
     SLPCostThreshold("slp-threshold", cl::init(0), cl::Hidden,
                      cl::desc("Only vectorize if you gain more than this "