[llvm] [SLP]Initial support for ordreded reductions (PR #182644)

via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 20 17:48:56 PST 2026


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 origin/main HEAD --extensions cpp -- llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index b1df83e02..044d0d457 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -25349,7 +25349,7 @@ class HorizontalReduction {
   }
 
   /// Checks if instruction is associative and can be vectorized.
-  enum class ReductionKind {Unordered, Ordered, None};
+  enum class ReductionKind { Unordered, Ordered, None };
   ReductionKind RK = ReductionKind::None;
   static ReductionKind isVectorizable(RecurKind Kind, Instruction *I,
                                       bool TwoElementReduction = false) {
@@ -25733,9 +25733,9 @@ public:
         // Also, do not try to reduce const values, if the operation is not
         // foldable.
         bool IsReducedVal = !EdgeInst || Level > RecursionMaxDepth ||
-            getRdxKind(EdgeInst) != RdxKind ||
-            IsCmpSelMinMax != isCmpSelMinMax(EdgeInst) ||
-            !hasRequiredNumberOfUses(IsCmpSelMinMax, EdgeInst);
+                            getRdxKind(EdgeInst) != RdxKind ||
+                            IsCmpSelMinMax != isCmpSelMinMax(EdgeInst) ||
+                            !hasRequiredNumberOfUses(IsCmpSelMinMax, EdgeInst);
         ReductionKind CurrentRK = IsReducedVal
                                       ? ReductionKind::None
                                       : isVectorizable(RdxKind, EdgeInst);

``````````

</details>


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


More information about the llvm-commits mailing list