summaryrefslogtreecommitdiffstats
path: root/llvm/tools/opt/opt.cpp
diff options
context:
space:
mode:
authorAlina Sbirlea <asbirlea@google.com>2019-04-25 04:49:48 +0000
committerAlina Sbirlea <asbirlea@google.com>2019-04-25 04:49:48 +0000
commit733c8c40c81de5fcc8fab264ccb6bce6d39138c5 (patch)
tree26f69098390f3d89a7677f8946770b48582a7edd /llvm/tools/opt/opt.cpp
parent3458ff361a1dc468cb42df6eaa99f5b09cc18443 (diff)
downloadbcm5719-llvm-733c8c40c81de5fcc8fab264ccb6bce6d39138c5.tar.gz
bcm5719-llvm-733c8c40c81de5fcc8fab264ccb6bce6d39138c5.zip
Enable LoopVectorization by default.
Summary: When refactoring vectorization flags, vectorization was disabled by default in the new pass manager. This patch re-enables is for both managers, and changes the assumptions opt makes, based on the new defaults. Comments in opt.cpp should clarify the intended use of all flags to enable/disable vectorization. Reviewers: chandlerc, jgorbe Subscribers: jlebar, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D61091 llvm-svn: 359167
Diffstat (limited to 'llvm/tools/opt/opt.cpp')
-rw-r--r--llvm/tools/opt/opt.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp
index 1a886ea7965..2119cc0183f 100644
--- a/llvm/tools/opt/opt.cpp
+++ b/llvm/tools/opt/opt.cpp
@@ -176,10 +176,6 @@ 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",
@@ -381,11 +377,13 @@ static void AddOptimizationPasses(legacy::PassManagerBase &MPM,
Builder.DisableUnrollLoops = (DisableLoopUnrolling.getNumOccurrences() > 0) ?
DisableLoopUnrolling : OptLevel == 0;
- // This is final, unless there is a #pragma vectorize enable
- if (DisableLoopVectorization)
- Builder.LoopVectorize = false;
- // If option wasn't forced via cmd line (-vectorize-loops, -loop-vectorize)
- else if (!Builder.LoopVectorize)
+ // Check if vectorization is explicitly disabled via -vectorize-loops=false.
+ // The flag enables vectorization in the LoopVectorize pass, it is on by
+ // default, and if it was disabled, leave it disabled here.
+ // Another flag that exists: -loop-vectorize, controls adding the pass to the
+ // pass manager. If set, the pass is added, and there is no additional check
+ // here for it.
+ if (Builder.LoopVectorize)
Builder.LoopVectorize = OptLevel > 1 && SizeLevel < 2;
// When #pragma vectorize is on for SLP, do the same as above
OpenPOWER on IntegriCloud