@@ -4479,19 +4479,17 @@ VectorizationFactor LoopVectorizationPlanner::selectEpilogueVectorizationFactor(
4479
4479
Type *TCType = Legal->getWidestInductionType ();
4480
4480
const SCEV *RemainingIterations = nullptr ;
4481
4481
unsigned MaxTripCount = 0 ;
4482
- if (MainLoopVF.isFixed ()) {
4483
- // TODO: extend to support scalable VFs.
4484
- const SCEV *TC = vputils::getSCEVExprForVPValue (
4485
- getPlanFor (MainLoopVF).getTripCount (), SE);
4486
- assert (!isa<SCEVCouldNotCompute>(TC) &&
4487
- " Trip count SCEV must be computable" );
4488
- RemainingIterations = SE.getURemExpr (
4489
- TC, SE.getConstant (TCType, MainLoopVF.getFixedValue () * IC));
4490
-
4491
- // No iterations left to process in the epilogue.
4492
- if (RemainingIterations->isZero ())
4493
- return Result;
4482
+ const SCEV *TC =
4483
+ vputils::getSCEVExprForVPValue (getPlanFor (MainLoopVF).getTripCount (), SE);
4484
+ assert (!isa<SCEVCouldNotCompute>(TC) && " Trip count SCEV must be computable" );
4485
+ RemainingIterations =
4486
+ SE.getURemExpr (TC, SE.getElementCount (TCType, MainLoopVF * IC));
4487
+
4488
+ // No iterations left to process in the epilogue.
4489
+ if (RemainingIterations->isZero ())
4490
+ return Result;
4494
4491
4492
+ if (MainLoopVF.isFixed ()) {
4495
4493
MaxTripCount = MainLoopVF.getFixedValue () * IC - 1 ;
4496
4494
if (SE.isKnownPredicate (CmpInst::ICMP_ULT, RemainingIterations,
4497
4495
SE.getConstant (TCType, MaxTripCount))) {
0 commit comments