[llvm] [SLP]Model single unique value insert + shuffle as splat + select, where profitable (PR #136590)

via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 21 11:07:55 PDT 2025


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 HEAD~1 HEAD --extensions cpp -- llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
``````````

</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 b19e34c34..25330ebeb 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -17312,7 +17312,7 @@ ResTy BoUpSLP::processBuildVector(const TreeEntry *E, Type *ScalarTy,
                   Vec, V);
               // Shuffle required?
               if (count(BVMask, PoisonMaskElem) <
-                      static_cast<int>(BVMask.size() - 1)) {
+                  static_cast<int>(BVMask.size() - 1)) {
                 SmallVector<int> NewMask(Mask.begin(), Mask.end());
                 for (auto [Idx, I] : enumerate(BVMask))
                   if (I != PoisonMaskElem)
@@ -17329,7 +17329,8 @@ ResTy BoUpSLP::processBuildVector(const TreeEntry *E, Type *ScalarTy,
               Vec = ShuffleBuilder.gather(NonConstants, Mask.size(), Vec);
             } else {
               Value *V = *find_if_not(NonConstants, IsaPred<UndefValue>);
-              SmallVector<Value *> Values(NonConstants.size(), PoisonValue::get(ScalarTy));
+              SmallVector<Value *> Values(NonConstants.size(),
+                                          PoisonValue::get(ScalarTy));
               Values[0] = V;
               Value *BV = ShuffleBuilder.gather(Values, BVMask.size());
               SmallVector<int> SplatMask(BVMask.size(), PoisonMaskElem);

``````````

</details>


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


More information about the llvm-commits mailing list