[llvm] [LoopVectorize] Improve Vectorization of Low Trip Count Loops (PR #195823)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 17 14:02:19 PDT 2026
================
@@ -3066,6 +3071,36 @@ LoopVectorizationCostModel::computeMaxVF(ElementCount UserVF, unsigned UserIC) {
}
}
+ // Allow cases where the ExactTC == (VF * IC) or ExactTC == (VF * IC) + 1.
+ //
+ // This produces at most 1 vector iteration, and at most 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.
+ //
+ // If a function is marked as minsize/optsize or OptForSize is set, do not
+ // allow this form of transformation as this will increase CodeSize.
+ //
+ // For loops with small bodies, the cost model is not reliable enough to
+ // accurately determine if vectorization is beneficial.
+ // LowTripCountLoopBodySizeLimit means only loops with larger bodies will
+ // be considered.
----------------
fhahn wrote:
I think this hsould be clear from the help text of the variable.
```suggestion
```
https://github.com/llvm/llvm-project/pull/195823
More information about the llvm-commits
mailing list