[llvm] [VectorCombine] Expand `vector_insert` into shufflevector for earlier cost optimizations (#145512) (PR #146479)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 1 09:12:43 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/InstCombine/InstCombineCalls.cpp llvm/lib/Transforms/Vectorize/VectorCombine.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
index 55c320103..bf4167cce 100644
--- a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
+++ b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
@@ -857,8 +857,10 @@ bool VectorCombine::foldVectorInsertToShuffle(Instruction &I) {
 
   SmallVector<int, 8> Mask(DstNumElts);
   std::iota(Mask.begin(), Mask.begin() + SubVecIdx, 0);
-  std::iota(Mask.begin() + SubVecIdx, Mask.begin() + SubVecIdx + SubVecNumElts, DstNumElts);
-  std::iota(Mask.begin() + SubVecIdx + SubVecNumElts, Mask.end(), SubVecIdx + SubVecNumElts);
+  std::iota(Mask.begin() + SubVecIdx, Mask.begin() + SubVecIdx + SubVecNumElts,
+            DstNumElts);
+  std::iota(Mask.begin() + SubVecIdx + SubVecNumElts, Mask.end(),
+            SubVecIdx + SubVecNumElts);
 
   auto *Shuffle = Builder.CreateShuffleVector(Vec, WidenShuffle, Mask);
   replaceValue(I, *Shuffle);

``````````

</details>


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


More information about the llvm-commits mailing list