summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDiego Novillo <dnovillo@google.com>2014-04-29 20:06:10 +0000
committerDiego Novillo <dnovillo@google.com>2014-04-29 20:06:10 +0000
commit55deff895d80ffa815cdf3620031714109e88ee1 (patch)
treeb2ab839fd1313b910f192bbd713b740f92c75e16 /lib
parentbbea6143f2a7632978f35328c12db581de35d7aa (diff)
downloadllvm-55deff895d80ffa815cdf3620031714109e88ee1.tar.gz
llvm-55deff895d80ffa815cdf3620031714109e88ee1.tar.bz2
llvm-55deff895d80ffa815cdf3620031714109e88ee1.tar.xz
Fix vectorization remarks.
This patch changes the vectorization remarks to also inform when vectorization is possible but not beneficial. Added tests to exercise some loop remarks. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207574 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Vectorize/LoopVectorize.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/Transforms/Vectorize/LoopVectorize.cpp b/lib/Transforms/Vectorize/LoopVectorize.cpp
index 586c220162..af0e686a52 100644
--- a/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -1209,6 +1209,13 @@ struct LoopVectorize : public FunctionPass {
if (UF == 1)
return false;
DEBUG(dbgs() << "LV: Trying to at least unroll the loops.\n");
+
+ // Report the unrolling decision.
+ F->getContext().emitOptimizationRemark(
+ DEBUG_TYPE, *F, L->getStartLoc(),
+ Twine("unrolled with interleaving factor " + Twine(UF) +
+ " (vectorization not beneficial)"));
+
// We decided not to vectorize, but we may want to unroll.
InnerLoopUnroller Unroller(L, SE, LI, DT, DL, TLI, UF);
Unroller.vectorize(&LVL);
@@ -1217,17 +1224,17 @@ struct LoopVectorize : public FunctionPass {
InnerLoopVectorizer LB(L, SE, LI, DT, DL, TLI, VF.Width, UF);
LB.vectorize(&LVL);
++LoopsVectorized;
+
+ // Report the vectorization decision.
+ F->getContext().emitOptimizationRemark(
+ DEBUG_TYPE, *F, L->getStartLoc(),
+ Twine("vectorized loop (vectorization factor: ") + Twine(VF.Width) +
+ ", unrolling interleave factor: " + Twine(UF) + ")");
}
// Mark the loop as already vectorized to avoid vectorizing again.
Hints.setAlreadyVectorized(L);
- // Report the vectorization decision.
- F->getContext().emitOptimizationRemark(
- DEBUG_TYPE, *F, L->getStartLoc(),
- Twine("vectorized loop (vectorization factor: ") + Twine(VF.Width) +
- ", unroll factor: " + Twine(UF) + ")");
-
DEBUG(verifyFunction(*L->getHeader()->getParent()));
return true;
}