@@ -4500,19 +4500,17 @@ VectorizationFactor LoopVectorizationPlanner::selectEpilogueVectorizationFactor(
45004500 Type *TCType = Legal->getWidestInductionType ();
45014501 const SCEV *RemainingIterations = nullptr ;
45024502 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;
45154512
4513+ if (MainLoopVF.isFixed ()) {
45164514 MaxTripCount = MainLoopVF.getFixedValue () * IC - 1 ;
45174515 if (SE.isKnownPredicate (CmpInst::ICMP_ULT, RemainingIterations,
45184516 SE.getConstant (TCType, MaxTripCount))) {
0 commit comments