[llvm] [LV] Ignore some costs when loop gets fully unrolled (PR #106699)
Igor Kirillov via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 5 02:25:52 PST 2024
================
@@ -5559,14 +5578,25 @@ 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()) {
+ assert(!foldTailByMasking());
----------------
igogo-x86 wrote:
Oops, no. I was checking the behaviour and forgot to undo the changes
https://github.com/llvm/llvm-project/pull/106699
More information about the llvm-commits
mailing list