Index: llvm/trunk/include/llvm/Passes/PassBuilder.h =================================================================== --- llvm/trunk/include/llvm/Passes/PassBuilder.h +++ llvm/trunk/include/llvm/Passes/PassBuilder.h @@ -81,6 +81,10 @@ /// 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: llvm/trunk/include/llvm/Transforms/Vectorize/SLPVectorizer.h =================================================================== --- llvm/trunk/include/llvm/Transforms/Vectorize/SLPVectorizer.h +++ llvm/trunk/include/llvm/Transforms/Vectorize/SLPVectorizer.h @@ -55,6 +55,8 @@ } // end namespace slpvectorizer +extern cl::opt RunSLPVectorization; + struct SLPVectorizerPass : public PassInfoMixin { using StoreList = SmallVector; using StoreListMap = MapVector; Index: llvm/trunk/lib/Passes/PassBuilder.cpp =================================================================== --- llvm/trunk/lib/Passes/PassBuilder.cpp +++ llvm/trunk/lib/Passes/PassBuilder.cpp @@ -214,6 +214,7 @@ PipelineTuningOptions::PipelineTuningOptions() { LoopInterleaving = EnableLoopInterleaving; LoopVectorization = EnableLoopVectorization; + SLPVectorization = RunSLPVectorization; LicmMssaOptCap = SetLicmMssaOptCap; LicmMssaNoAccForPromotionCap = SetLicmMssaNoAccForPromotionCap; } @@ -888,7 +889,8 @@ sinkCommonInsts(true))); // Optimize parallel scalar instruction chains into SIMD instructions. - OptimizePM.addPass(SLPVectorizerPass()); + if (PTO.SLPVectorization) + OptimizePM.addPass(SLPVectorizerPass()); OptimizePM.addPass(InstCombinePass()); Index: llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp =================================================================== --- llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp +++ llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp @@ -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; @@ -51,10 +52,6 @@ cl::ZeroOrMore, cl::desc("Run Partial inlinining pass")); static cl::opt -RunSLPVectorization("vectorize-slp", cl::Hidden, - cl::desc("Run the SLP vectorization passes")); - -static cl::opt UseGVNAfterVectorization("use-gvn-after-vectorization", cl::init(false), cl::Hidden, cl::desc("Run GVN instead of Early CSE after vectorization passes")); Index: llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp =================================================================== --- llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -105,6 +105,10 @@ STATISTIC(NumVectorInstructions, "Number of vector instructions generated"); +cl::opt + llvm::RunSLPVectorization("vectorize-slp", cl::init(true), cl::Hidden, + cl::desc("Run the SLP vectorization passes")); + static cl::opt SLPCostThreshold("slp-threshold", cl::init(0), cl::Hidden, cl::desc("Only vectorize if you gain more than this "