[PATCH] D61616: [NewPassManager] Add tuning option: SLPVectorization [NFC].
Alina Sbirlea via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 6 16:05:07 PDT 2019
asbirlea created this revision.
asbirlea added a reviewer: chandlerc.
Herald added subscribers: jlebar, mehdi_amini.
Herald added a project: LLVM.
Mirror tuning option from old pass manager in new pass manager.
Repository:
rL LLVM
https://reviews.llvm.org/D61616
Files:
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: lib/Transforms/Vectorize/SLPVectorizer.cpp
===================================================================
--- lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -105,6 +105,10 @@
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 "
Index: lib/Transforms/IPO/PassManagerBuilder.cpp
===================================================================
--- lib/Transforms/IPO/PassManagerBuilder.cpp
+++ lib/Transforms/IPO/PassManagerBuilder.cpp
@@ -44,6 +44,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 @@
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: lib/Passes/PassBuilder.cpp
===================================================================
--- lib/Passes/PassBuilder.cpp
+++ lib/Passes/PassBuilder.cpp
@@ -214,6 +214,7 @@
PipelineTuningOptions::PipelineTuningOptions() {
LoopInterleaving = EnableLoopInterleaving;
LoopVectorization = EnableLoopVectorization;
+ SLPVectorization = RunSLPVectorization;
ForgetAllSCEVInLoopUnroll = ForgetSCEVInLoopUnroll;
LicmMssaOptCap = SetLicmMssaOptCap;
LicmMssaNoAccForPromotionCap = SetLicmMssaNoAccForPromotionCap;
@@ -890,7 +891,8 @@
sinkCommonInsts(true)));
// Optimize parallel scalar instruction chains into SIMD instructions.
- OptimizePM.addPass(SLPVectorizerPass());
+ if (PTO.SLPVectorization)
+ OptimizePM.addPass(SLPVectorizerPass());
OptimizePM.addPass(InstCombinePass());
Index: include/llvm/Transforms/Vectorize/SLPVectorizer.h
===================================================================
--- include/llvm/Transforms/Vectorize/SLPVectorizer.h
+++ include/llvm/Transforms/Vectorize/SLPVectorizer.h
@@ -55,6 +55,8 @@
} // end namespace slpvectorizer
+extern cl::opt<bool> RunSLPVectorization;
+
struct SLPVectorizerPass : public PassInfoMixin<SLPVectorizerPass> {
using StoreList = SmallVector<StoreInst *, 8>;
using StoreListMap = MapVector<Value *, StoreList>;
Index: include/llvm/Passes/PassBuilder.h
===================================================================
--- include/llvm/Passes/PassBuilder.h
+++ 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 forget all SCEV loops in LoopUnroll. Its default value
/// is that of the flag: `-forget-scev-loop-unroll`.
bool ForgetAllSCEVInLoopUnroll;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61616.198360.patch
Type: text/x-patch
Size: 3488 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190506/e7693188/attachment.bin>
More information about the llvm-commits
mailing list