[llvm] [LV] Ignore some costs when loop gets fully unrolled (PR #106699)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 3 12:28:10 PST 2024
================
@@ -5557,14 +5576,23 @@ InstructionCost LoopVectorizationCostModel::computePredInstDiscount(
InstructionCost LoopVectorizationCostModel::expectedCost(ElementCount VF) {
InstructionCost Cost;
+ // If the vector loop gets executed exactly once with the given VF, ignore the
+ // costs of comparison and induction instructions, as they'll get simplified
+ // away.
+ SmallPtrSet<Instruction *, 2> ValuesToIgnoreForVF;
+ auto TC = PSE.getSE()->getSmallConstantTripCount(TheLoop);
+ if (VF.isFixed() && TC == VF.getFixedValue() && !foldTailByMasking())
----------------
fhahn wrote:
Thanks for checking, that makes sense.
https://github.com/llvm/llvm-project/pull/106699
More information about the llvm-commits
mailing list