Skip to content

Commit 0102bdf

Browse files
committed
!fixup only invalidate decisions if MaxVF changed after maximizing.
1 parent 46d3728 commit 0102bdf

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)