File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
llvm/lib/Transforms/Vectorize Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -3924,6 +3924,8 @@ ElementCount LoopVectorizationCostModel::getMaximizedVFForTarget(
39243924
39253925 ElementCount MaxVF = clampVFByMaxTripCount (MaxVectorElementCount,
39263926 MaxTripCount, FoldTailByMasking);
3927+ // If the MaxVF was already clamped, there's no point in trying to pick a
3928+ // larger one.
39273929 if (MaxVF != MaxVectorElementCount)
39283930 return MaxVF;
39293931
@@ -3953,10 +3955,12 @@ ElementCount LoopVectorizationCostModel::getMaximizedVFForTarget(
39533955
39543956 MaxVF = clampVFByMaxTripCount (MaxVF, MaxTripCount, FoldTailByMasking);
39553957
3956- // Invalidate any widening decisions we might have made, in case the loop
3957- // requires prediction (decided later), but we have already made some
3958- // load/store widening decisions.
3959- invalidateCostModelingDecisions ();
3958+ if (MaxVectorElementCount != MaxVF) {
3959+ // Invalidate any widening decisions we might have made, in case the loop
3960+ // requires prediction (decided later), but we have already made some
3961+ // load/store widening decisions.
3962+ invalidateCostModelingDecisions ();
3963+ }
39603964 }
39613965 return MaxVF;
39623966}
You can’t perform that action at this time.
0 commit comments