Skip to content

Commit e8aa0b6

Browse files
authored
[LV]: Ensure fairness when selecting epilogue VF. (#155547)
Consider IC when deciding if epilogue profitable for scalable vectors, same as fixed-width vectors.
1 parent eb8e8e8 commit e8aa0b6

File tree

4 files changed

+342
-247
lines changed

4 files changed

+342
-247
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4320,16 +4320,10 @@ bool LoopVectorizationCostModel::isEpilogueVectorizationProfitable(
43204320
if (TTI.getMaxInterleaveFactor(VF) <= 1)
43214321
return false;
43224322

4323-
// TODO: PR #108190 introduced a discrepancy between fixed-width and scalable
4324-
// VFs when deciding profitability.
4325-
// See related "TODO: extend to support scalable VFs." in
4326-
// selectEpilogueVectorizationFactor.
4327-
unsigned Multiplier = VF.isFixed() ? IC : 1;
43284323
unsigned MinVFThreshold = EpilogueVectorizationMinVF.getNumOccurrences() > 0
43294324
? EpilogueVectorizationMinVF
43304325
: TTI.getEpilogueVectorizationMinVF();
4331-
return estimateElementCount(VF * Multiplier, VScaleForTuning) >=
4332-
MinVFThreshold;
4326+
return estimateElementCount(VF * IC, VScaleForTuning) >= MinVFThreshold;
43334327
}
43344328

43354329
VectorizationFactor LoopVectorizationPlanner::selectEpilogueVectorizationFactor(

0 commit comments

Comments
 (0)