diff options
author | Arnold Schwaighofer <aschwaighofer@apple.com> | 2013-12-03 16:33:06 +0000 |
---|---|---|
committer | Arnold Schwaighofer <aschwaighofer@apple.com> | 2013-12-03 16:33:06 +0000 |
commit | df9c9da88402e393343d5e199b0ebaa681b3a1ce (patch) | |
tree | 72865e218e86de7ee52b33b116e927421f2a6046 /tools/opt | |
parent | ac07cd54ed48cdc160eba7625eefe09c5f484eb2 (diff) | |
download | llvm-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.cpp | 16 |
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); |