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
This commit is contained in:
Diego Novillo
2014-04-29 20:06:10 +00:00
parent bbea6143f2
commit 55deff895d
3 changed files with 105 additions and 6 deletions

View File

@ -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;
}