@@ -4497,19 +4497,17 @@ VectorizationFactor LoopVectorizationPlanner::selectEpilogueVectorizationFactor(
4497
4497
Type *TCType = Legal->getWidestInductionType ();
4498
4498
const SCEV *RemainingIterations = nullptr ;
4499
4499
unsigned MaxTripCount = 0 ;
4500
- if (MainLoopVF.isFixed ()) {
4501
- // TODO: extend to support scalable VFs.
4502
- const SCEV *TC = vputils::getSCEVExprForVPValue (
4503
- getPlanFor (MainLoopVF).getTripCount (), SE);
4504
- assert (!isa<SCEVCouldNotCompute>(TC) &&
4505
- " Trip count SCEV must be computable" );
4506
- RemainingIterations = SE.getURemExpr (
4507
- TC, SE.getConstant (TCType, MainLoopVF.getFixedValue () * IC));
4508
-
4509
- // No iterations left to process in the epilogue.
4510
- if (RemainingIterations->isZero ())
4511
- return Result;
4500
+ const SCEV *TC =
4501
+ vputils::getSCEVExprForVPValue (getPlanFor (MainLoopVF).getTripCount (), SE);
4502
+ assert (!isa<SCEVCouldNotCompute>(TC) && " Trip count SCEV must be computable" );
4503
+ RemainingIterations =
4504
+ SE.getURemExpr (TC, SE.getElementCount (TCType, MainLoopVF * IC));
4505
+
4506
+ // No iterations left to process in the epilogue.
4507
+ if (RemainingIterations->isZero ())
4508
+ return Result;
4512
4509
4510
+ if (MainLoopVF.isFixed ()) {
4513
4511
MaxTripCount = MainLoopVF.getFixedValue () * IC - 1 ;
4514
4512
if (SE.isKnownPredicate (CmpInst::ICMP_ULT, RemainingIterations,
4515
4513
SE.getConstant (TCType, MaxTripCount))) {
0 commit comments