[llvm] [LoopVectorize] Improve Vectorization of Low Trip Count Loops (PR #195823)
Jack Styles via llvm-commits
llvm-commits at lists.llvm.org
Mon May 11 05:31:50 PDT 2026
================
@@ -3026,6 +3031,33 @@ LoopVectorizationCostModel::computeMaxVF(ElementCount UserVF, unsigned UserIC) {
MaxFactors.ScalableVF = ElementCount::getScalable(0);
return MaxFactors;
}
+ // Allow cases where the ExactTC == VF + 1. VF can be any power of
+ // 2 between 2 and MaxVF.
+ //
+ // This produces 1 vector iteration, and 1 scalar iteration with
+ // no remainder. Later passes will eliminate the loop and leave
+ // straight-line code as the both iteration counts are statically known.
+ ElementCount ExactTC = getSmallConstantTripCount(PSE.getSE(), TheLoop);
+ if (EpilogueLoweringStatus == CM_EpilogueNotAllowedLowTripLoop &&
+ ExactTC.isFixed()) {
----------------
Stylie777 wrote:
Apologies I thought I responded to that earlier comment. from my understanding if one is returning fixed, the other will return fixed values. I don't think these can be mixed. If so I will remove that case.
I will get that fixed and updated.
https://github.com/llvm/llvm-project/pull/195823
More information about the llvm-commits
mailing list