summaryrefslogtreecommitdiff
path: root/tools/opt
diff options
context:
space:
mode:
authorArnold Schwaighofer <aschwaighofer@apple.com>2013-12-03 16:33:06 +0000
committerArnold Schwaighofer <aschwaighofer@apple.com>2013-12-03 16:33:06 +0000
commitdf9c9da88402e393343d5e199b0ebaa681b3a1ce (patch)
tree72865e218e86de7ee52b33b116e927421f2a6046 /tools/opt
parentac07cd54ed48cdc160eba7625eefe09c5f484eb2 (diff)
downloadllvm-df9c9da88402e393343d5e199b0ebaa681b3a1ce.tar.gz
llvm-df9c9da88402e393343d5e199b0ebaa681b3a1ce.tar.bz2
llvm-df9c9da88402e393343d5e199b0ebaa681b3a1ce.tar.xz
opt: Mirror vectorization presets of clang
clang enables vectorization at optimization levels > 1 and size level < 2. opt should behave similarily. Loop vectorization and SLP vectorization can be disabled with the flags -disable-(loop/slp)-vectorization. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196294 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/opt')
-rw-r--r--tools/opt/opt.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp
index 8a8da01a99..dba16f72da 100644
--- a/tools/opt/opt.cpp
+++ b/tools/opt/opt.cpp
@@ -139,6 +139,16 @@ static cl::opt<bool>
DisableLoopUnrolling("disable-loop-unrolling",
cl::desc("Disable loop unrolling in all relevant passes"),
cl::init(false));
+static cl::opt<bool>
+DisableLoopVectorization("disable-loop-vectorization",
+ cl::desc("Disable the loop vectorization pass"),
+ cl::init(false));
+
+static cl::opt<bool>
+DisableSLPVectorization("disable-slp-vectorization",
+ cl::desc("Disable the slp vectorization pass"),
+ cl::init(false));
+
static cl::opt<bool>
DisableSimplifyLibCalls("disable-simplify-libcalls",
@@ -461,8 +471,10 @@ static void AddOptimizationPasses(PassManagerBase &MPM,FunctionPassManager &FPM,
Builder.DisableUnrollLoops = (DisableLoopUnrolling.getNumOccurrences() > 0) ?
DisableLoopUnrolling : OptLevel == 0;
- Builder.LoopVectorize = OptLevel > 1 && SizeLevel < 2;
- Builder.SLPVectorize = true;
+ Builder.LoopVectorize =
+ DisableLoopVectorization ? false : OptLevel > 1 && SizeLevel < 2;
+ Builder.SLPVectorize =
+ DisableSLPVectorization ? false : OptLevel > 1 && SizeLevel < 2;
Builder.populateFunctionPassManager(FPM);
Builder.populateModulePassManager(MPM);