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