[llvm] [VectorCombine] Support pattern `bitop(cast(x), C) -> cast(bitop(x, InvC))` (PR #155216)

via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 25 00:24:13 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/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 1992c28d3..8f1c1e6c9 100644
--- a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
+++ b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
@@ -960,8 +960,8 @@ static Constant *getLosslessInvCast(Constant *C, Type *InvCastTo,
     auto *InvC = ConstantExpr::getTrunc(C, InvCastTo);
     auto *CastInvC = ConstantFoldCastOperand(CastOp, InvC, C->getType(), DL);
     // Must satisfy CastOp(InvC) == C.
-    if (!CastInvC || CastInvC != C) 
-        return nullptr;
+    if (!CastInvC || CastInvC != C)
+      return nullptr;
     if (CastOp == Instruction::ZExt) {
       auto *SExtInvC =
           ConstantFoldCastOperand(Instruction::SExt, InvC, C->getType(), DL);

``````````

</details>


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


More information about the llvm-commits mailing list