[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:31:50 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());
----------------
fhahn wrote:
Was this intentionally added? IIUC this is causing crashes as per the earlier comment thread (which seems to have been dropped by Github here)
https://github.com/llvm/llvm-project/pull/106699
More information about the llvm-commits
mailing list