[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
Wed Nov 13 13:27:02 PST 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:
The current code is still a bit confusing, could w not create a constant that is set to `MainLoopVF.getKnownMinValue() * IC - 1`?
https://github.com/llvm/llvm-project/pull/108190
More information about the llvm-commits
mailing list