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

via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 26 13:26:57 PST 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 00b6d032a22196bc14e4e30e413c040eb1b65da4 f5cb46884d4eacd818df19676149d31fa616553c -- llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index c2fad626f2..a5bd375374 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -5396,7 +5396,8 @@ LoopVectorizationCostModel::selectInterleaveCount(ElementCount VF,
   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;
+    unsigned availableTC =
+        (requiresScalarEpilogue(VF.isVector())) ? KnownTC - 1 : KnownTC;
 
     // If trip count is known we select between two prospective ICs, where
     // 1) the aggressive IC is capped by the trip count divided by VF
@@ -5413,8 +5414,10 @@ LoopVectorizationCostModel::selectInterleaveCount(ElementCount VF,
     MaxInterleaveCount = InterleaveCountLB;
 
     if (InterleaveCountUB != InterleaveCountLB) {
-      unsigned TailTripCountUB = (availableTC % (EstimatedVF * InterleaveCountUB));
-      unsigned TailTripCountLB = (availableTC % (EstimatedVF * InterleaveCountLB));
+      unsigned TailTripCountUB =
+          (availableTC % (EstimatedVF * InterleaveCountUB));
+      unsigned TailTripCountLB =
+          (availableTC % (EstimatedVF * InterleaveCountLB));
       // If both produce same scalar tail, maximize the IC to do the same work
       // in fewer vector loop iterations
       if (TailTripCountUB == TailTripCountLB)
@@ -5423,7 +5426,9 @@ LoopVectorizationCostModel::selectInterleaveCount(ElementCount VF,
   } else if (BestKnownTC > 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())) ? (*BestKnownTC) - 1 : *BestKnownTC;
+    unsigned availableTC = (requiresScalarEpilogue(VF.isVector()))
+                               ? (*BestKnownTC) - 1
+                               : *BestKnownTC;
 
     // If trip count is an estimated compile time constant, limit the
     // IC to be capped by the trip count divided by VF * 2, such that the vector

``````````

</details>


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


More information about the llvm-commits mailing list