[llvm] [LV] Always try to use fixed VF for low TC loops if no epilogue allowed. (PR #226318)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 25 01:03:06 PDT 2026


================
@@ -3056,17 +3056,16 @@ LoopVectorizationCostModel::computeMaxVF(ElementCount UserVF, unsigned UserIC) {
   if (ExpectedTC && ExpectedTC->isFixed() &&
       ExpectedTC->getFixedValue() <=
           TTI.getMinTripCountTailFoldingThreshold()) {
-    if (MaxPowerOf2RuntimeVF > 0u) {
-      // If we have a low-trip-count, and the fixed-width VF is known to divide
-      // the trip count but the scalable factor does not, use the fixed-width
-      // factor in preference to allow the generation of a non-predicated loop.
-      if (EpilogueLoweringStatus == CM_EpilogueNotAllowedLowTripLoop &&
-          NoScalarEpilogueNeeded(MaxFactors.FixedVF.getFixedValue())) {
-        LLVM_DEBUG(dbgs() << "LV: Picking a fixed-width so that no tail will "
-                             "remain for any chosen VF.\n");
-        MaxFactors.ScalableVF = ElementCount::getScalable(0);
-        return MaxFactors;
-      }
+    // If we have a low-trip-count, and the fixed-width VF is known to divide
+    // the trip count but the scalable factor does not (or its maximum runtime
+    // VF is unknown), use the fixed-width factor in preference to allow the
----------------
sdesmalen-arm wrote:

nit:
```suggestion
    // the trip count, use the fixed-width factor in preference to allow the
```

https://github.com/llvm/llvm-project/pull/226318


More information about the llvm-commits mailing list