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(
3924
3924
3925
3925
ElementCount MaxVF = clampVFByMaxTripCount (MaxVectorElementCount,
3926
3926
MaxTripCount, FoldTailByMasking);
3927
+ // If the MaxVF was already clamped, there's no point in trying to pick a
3928
+ // larger one.
3927
3929
if (MaxVF != MaxVectorElementCount)
3928
3930
return MaxVF;
3929
3931
@@ -3953,10 +3955,12 @@ ElementCount LoopVectorizationCostModel::getMaximizedVFForTarget(
3953
3955
3954
3956
MaxVF = clampVFByMaxTripCount (MaxVF, MaxTripCount, FoldTailByMasking);
3955
3957
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
+ }
3960
3964
}
3961
3965
return MaxVF;
3962
3966
}
You can’t perform that action at this time.
0 commit comments