[llvm] [InstCombine] Let shrinkSplatShuffle act on vectors of different lengths (PR #148593)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 14 03:00:42 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/InstCombineCasts.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
index 8a98fd323..524203e47 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -712,9 +712,9 @@ static Instruction *shrinkSplatShuffle(TruncInst &Trunc,
           Shuf->getOperand(0)->getType()->getScalarType()) {
     // trunc (shuf X, Undef, SplatMask) --> shuf (trunc X), Poison, SplatMask
     // trunc (shuf X, Poison, SplatMask) --> shuf (trunc X), Poison, SplatMask
-    auto *const NewTruncTy =
-        VectorType::get(Trunc.getType()->getScalarType(),
-                        cast<VectorType>(Shuf->getOperand(0)->getType())->getElementCount());
+    auto *const NewTruncTy = VectorType::get(
+        Trunc.getType()->getScalarType(),
+        cast<VectorType>(Shuf->getOperand(0)->getType())->getElementCount());
     Value *NarrowOp = Builder.CreateTrunc(Shuf->getOperand(0), NewTruncTy);
     return new ShuffleVectorInst(NarrowOp, Shuf->getShuffleMask());
   }

``````````

</details>


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


More information about the llvm-commits mailing list