[llvm] [LV] Update interleaving count computation when scalar epilogue loop needs to run at least once (PR #79651)

Nilanjana Basu via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 26 16:21:34 PST 2024


================
@@ -5393,7 +5393,11 @@ LoopVectorizationCostModel::selectInterleaveCount(ElementCount VF,
   assert(EstimatedVF >= 1 && "Estimated VF shouldn't be less than 1");
 
   unsigned KnownTC = PSE.getSE()->getSmallConstantTripCount(TheLoop);
-  if (KnownTC) {
+  if (KnownTC > 0) {
+    // At least one iteration must be scalar when this constraint holds. So the
+    // maximum available iterations for interleaving is one less.
+    unsigned availableTC = (requiresScalarEpilogue(VF.isVector())) ? KnownTC - 1 : KnownTC;
----------------
nilanjana87 wrote:

Had forgotten to run clang-format. Updated the variable names as well.

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


More information about the llvm-commits mailing list