summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
diff options
context:
space:
mode:
authorMichael Kruse <llvm@meinersbur.de>2018-12-18 17:46:09 +0000
committerMichael Kruse <llvm@meinersbur.de>2018-12-18 17:46:09 +0000
commitd4eb13c88061d90cf6b8848ade1b38b8b94b509e (patch)
treef3c4ccbf5a9b73efb2e85aabef98263aa9bfbedf /llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
parentea79468b41ed840e9078a2910a8de73d4108c31d (diff)
downloadbcm5719-llvm-d4eb13c88061d90cf6b8848ade1b38b8b94b509e.tar.gz
bcm5719-llvm-d4eb13c88061d90cf6b8848ade1b38b8b94b509e.zip
[LoopVectorize] Rename pass options. NFC.
Rename: NoUnrolling to InterleaveOnlyWhenForced and AlwaysVectorize to !VectorizeOnlyWhenForced Contrary to what the name 'AlwaysVectorize' suggests, it does not unconditionally vectorize all loops, but applies a cost model to determine whether vectorization is profitable to all loops. Hence, passing false will disable the cost model, except when a loop is marked with llvm.loop.vectorize.enable. The 'OnlyWhenForced' suffix (suggested by @hfinkel in D55716) better matches this behavior. Similarly, 'NoUnrolling' disables the profitability cost model for interleaving (a term to distinguish it from unrolling by the LoopUnrollPass); rename it for consistency. Differential Revision: https://reviews.llvm.org/D55785 llvm-svn: 349513
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/LoopVectorize.cpp')
-rw-r--r--llvm/lib/Transforms/Vectorize/LoopVectorize.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 0341cce214a..c74352cf703 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -1359,7 +1359,8 @@ static bool isExplicitVecOuterLoop(Loop *OuterLp,
return false;
Function *Fn = OuterLp->getHeader()->getParent();
- if (!Hints.allowVectorization(Fn, OuterLp, false /*AlwaysVectorize*/)) {
+ if (!Hints.allowVectorization(Fn, OuterLp,
+ true /*VectorizeOnlyWhenForced*/)) {
LLVM_DEBUG(dbgs() << "LV: Loop hints prevent outer loop vectorization.\n");
return false;
}
@@ -1415,10 +1416,11 @@ struct LoopVectorize : public FunctionPass {
LoopVectorizePass Impl;
- explicit LoopVectorize(bool NoUnrolling = false, bool AlwaysVectorize = true)
+ explicit LoopVectorize(bool InterleaveOnlyWhenForced = false,
+ bool VectorizeOnlyWhenForced = false)
: FunctionPass(ID) {
- Impl.DisableUnrolling = NoUnrolling;
- Impl.AlwaysVectorize = AlwaysVectorize;
+ Impl.InterleaveOnlyWhenForced = InterleaveOnlyWhenForced;
+ Impl.VectorizeOnlyWhenForced = VectorizeOnlyWhenForced;
initializeLoopVectorizePass(*PassRegistry::getPassRegistry());
}
@@ -6022,8 +6024,9 @@ INITIALIZE_PASS_END(LoopVectorize, LV_NAME, lv_name, false, false)
namespace llvm {
-Pass *createLoopVectorizePass(bool NoUnrolling, bool AlwaysVectorize) {
- return new LoopVectorize(NoUnrolling, AlwaysVectorize);
+Pass *createLoopVectorizePass(bool InterleaveOnlyWhenForced,
+ bool VectorizeOnlyWhenForced) {
+ return new LoopVectorize(InterleaveOnlyWhenForced, VectorizeOnlyWhenForced);
}
} // end namespace llvm
@@ -7141,7 +7144,7 @@ bool LoopVectorizePass::processLoop(Loop *L) {
<< L->getHeader()->getParent()->getName() << "\" from "
<< DebugLocStr << "\n");
- LoopVectorizeHints Hints(L, DisableUnrolling, *ORE);
+ LoopVectorizeHints Hints(L, InterleaveOnlyWhenForced, *ORE);
LLVM_DEBUG(
dbgs() << "LV: Loop hints:"
@@ -7165,7 +7168,7 @@ bool LoopVectorizePass::processLoop(Loop *L) {
// less verbose reporting vectorized loops and unvectorized loops that may
// benefit from vectorization, respectively.
- if (!Hints.allowVectorization(F, L, AlwaysVectorize)) {
+ if (!Hints.allowVectorization(F, L, VectorizeOnlyWhenForced)) {
LLVM_DEBUG(dbgs() << "LV: Loop hints prevent vectorization.\n");
return false;
}
OpenPOWER on IntegriCloud