@@ -4378,20 +4378,20 @@ VectorizationFactor LoopVectorizationPlanner::selectEpilogueVectorizationFactor(
43784378 bool ScalableTC = match (TC, m_scev_Mul (m_SCEV (KnownMinTC), m_SCEVVScale ())) ||
43794379 match (TC, m_scev_Mul (m_SCEVVScale (), m_SCEV (KnownMinTC)));
43804380 // Use versions of TC and VF in which both are either scalable or fixed.
4381- if (ScalableTC == MainLoopVF.isScalable ()) {
4381+ if (ScalableTC == MainLoopVF.isScalable ())
43824382 RemainingIterations =
43834383 SE.getURemExpr (TC, SE.getElementCount (TCType, MainLoopVF * IC));
4384- } else {
4385- if (ScalableTC)
4386- RemainingIterations = SE.getURemExpr (
4387- KnownMinTC, SE.getElementCount (TCType, MainLoopVF * IC));
4388- else
4389- RemainingIterations = SE. getURemExpr (
4390- TC, SE. getElementCount (TCType, EstimatedRuntimeVF * IC));
4391- }
4384+ else if (ScalableTC) {
4385+ const SCEV *EstimatedTC = SE. getMulExpr (
4386+ KnownMinTC, SE.getConstant (TCType, CM. getVScaleForTuning (). value ()));
4387+ RemainingIterations = SE.getURemExpr (
4388+ EstimatedTC, SE. getElementCount (TCType, MainLoopVF * IC));
4389+ } else
4390+ RemainingIterations =
4391+ SE. getURemExpr (TC, SE. getElementCount (TCType, EstimatedRuntimeVF * IC));
43924392
43934393 // No iterations left to process in the epilogue.
4394- if (!RemainingIterations || RemainingIterations->isZero ())
4394+ if (RemainingIterations->isZero ())
43954395 return Result;
43964396
43974397 if (MainLoopVF.isFixed ()) {
0 commit comments