[llvm] [LV] Vectorize Epilogues for loops with small VF but high IC (PR #108190)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 4 03:13:39 PDT 2024
================
@@ -4719,6 +4733,14 @@ VectorizationFactor LoopVectorizationPlanner::selectEpilogueVectorizationFactor(
"Trip count SCEV must be computable");
RemainingIterations = SE.getURemExpr(
TC, SE.getConstant(TCType, MainLoopVF.getKnownMinValue() * IC));
+ const APInt MaxRemainingIterations =
+ SE.getUnsignedRangeMax(RemainingIterations);
+ // Guard against huge trip counts.
+ if (MaxRemainingIterations.getActiveBits() <= 32) {
----------------
fhahn wrote:
Hm, I would assume the max would always be `MainLoopVF.getKnownMinValue() * IC - 1` or less, if the trip count is known to be constant? Curios why this guard is needed?
https://github.com/llvm/llvm-project/pull/108190
More information about the llvm-commits
mailing list