[PATCH] D103700: [LV] Fix bug when unrolling (only) a loop with non-latch exit
Ayal Zaks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 6 11:55:47 PDT 2021
Ayal added inline comments.
================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:3175
+ // iterations check ensures that N >= Step.
+ if (Cost->requiresScalarEpilogue()) {
auto *IsZero = Builder.CreateICmpEQ(R, ConstantInt::get(R->getType(), 0));
----------------
What if a loop has a single exiting block - the loop latch, and an interleave group that requires a scalar epilog, but we decide to unroll the loop w/o vectorizing it? Such a (test)case should be unrolled w/o a scalar epilog.
Note that InterleaveInfo.requiresScalarEpilogue() is relevant only when vectorizing but is otherwise independent of VF, so should force a scalar epilog in conjunction with the original "if (VF > 1)" of D19487. Exiting from a non-latch block, OTOH, as introduced in D93317, should force a scalar epilog for any VF, including 1.
Also curious if D94892 should be applicable to epilog vectorization, as commented there.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103700/new/
https://reviews.llvm.org/D103700
More information about the llvm-commits
mailing list