@@ -937,8 +937,8 @@ class LoopVectorizationCostModel {
937937 // / user options, for the given register kind.
938938 bool useMaxBandwidth (TargetTransformInfo::RegisterKind RegKind);
939939
940- // / \return True if register pressure should be calculated for the given VF.
941- bool shouldCalculateRegPressureForVF (ElementCount VF);
940+ // / \return True if register pressure should be considered for the given VF.
941+ bool shouldConsiderRegPressureForVF (ElementCount VF);
942942
943943 // / \return The size (in bits) of the smallest and widest types in the code
944944 // / that needs to be vectorized. We ignore values that remain scalar such as
@@ -3727,7 +3727,7 @@ LoopVectorizationCostModel::computeMaxVF(ElementCount UserVF, unsigned UserIC) {
37273727 return FixedScalableVFPair::getNone ();
37283728}
37293729
3730- bool LoopVectorizationCostModel::shouldCalculateRegPressureForVF (
3730+ bool LoopVectorizationCostModel::shouldConsiderRegPressureForVF (
37313731 ElementCount VF) {
37323732 if (!useMaxBandwidth (VF.isScalable ()
37333733 ? TargetTransformInfo::RGK_ScalableVector
@@ -4172,8 +4172,9 @@ VectorizationFactor LoopVectorizationPlanner::selectVectorizationFactor() {
41724172 P->vectorFactors ().end ());
41734173
41744174 SmallVector<VPRegisterUsage, 8 > RUs;
4175- if (CM.useMaxBandwidth (TargetTransformInfo::RGK_ScalableVector) ||
4176- CM.useMaxBandwidth (TargetTransformInfo::RGK_FixedWidthVector))
4175+ if (any_of (VFs, [this ](ElementCount VF) {
4176+ return CM.shouldConsiderRegPressureForVF (VF);
4177+ }))
41774178 RUs = calculateRegisterUsageForPlan (*P, VFs, TTI, CM.ValuesToIgnore );
41784179
41794180 for (unsigned I = 0 ; I < VFs.size (); I++) {
@@ -4185,7 +4186,7 @@ VectorizationFactor LoopVectorizationPlanner::selectVectorizationFactor() {
41854186 // / If the register pressure needs to be considered for VF,
41864187 // / don't consider the VF as valid if it exceeds the number
41874188 // / of registers for the target.
4188- if (CM.shouldCalculateRegPressureForVF (VF) &&
4189+ if (CM.shouldConsiderRegPressureForVF (VF) &&
41894190 RUs[I].exceedsMaxNumRegs (TTI, ForceTargetNumVectorRegs))
41904191 continue ;
41914192
@@ -7020,8 +7021,9 @@ VectorizationFactor LoopVectorizationPlanner::computeBestVF() {
70207021 P->vectorFactors ().end ());
70217022
70227023 SmallVector<VPRegisterUsage, 8 > RUs;
7023- if (CM.useMaxBandwidth (TargetTransformInfo::RGK_ScalableVector) ||
7024- CM.useMaxBandwidth (TargetTransformInfo::RGK_FixedWidthVector))
7024+ if (any_of (VFs, [this ](ElementCount VF) {
7025+ return CM.shouldConsiderRegPressureForVF (VF);
7026+ }))
70257027 RUs = calculateRegisterUsageForPlan (*P, VFs, TTI, CM.ValuesToIgnore );
70267028
70277029 for (unsigned I = 0 ; I < VFs.size (); I++) {
@@ -7047,7 +7049,7 @@ VectorizationFactor LoopVectorizationPlanner::computeBestVF() {
70477049 InstructionCost Cost = cost (*P, VF);
70487050 VectorizationFactor CurrentFactor (VF, Cost, ScalarCost);
70497051
7050- if (CM.shouldCalculateRegPressureForVF (VF) &&
7052+ if (CM.shouldConsiderRegPressureForVF (VF) &&
70517053 RUs[I].exceedsMaxNumRegs (TTI, ForceTargetNumVectorRegs)) {
70527054 LLVM_DEBUG (dbgs () << " LV(REG): Not considering vector loop of width "
70537055 << VF << " because it uses too many registers\n " );
0 commit comments