[llvm] [InstCombine] Fold `mul (sext bool X), Y` into `select X, -Y, 0` (PR #84792)

via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 13 09:33:16 PDT 2024


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 6e27dd47e1fc17cf661b568901fe7392ed1b8f2b 4186818ee00ce11a52490ded643864bcbc2abc76 -- llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
index 6fee410ccd..fe266fcf41 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
@@ -452,10 +452,10 @@ Instruction *InstCombinerImpl::visitMul(BinaryOperator &I) {
   // mul Y, (sext X) -> select X, -Y, 0
   if (match(&I, m_c_Mul(m_OneUse(m_SExt(m_Value(X))), m_Value(Y))) &&
       X->getType()->isIntOrIntVectorTy(1))
-    return SelectInst::Create(X,
-                              Builder.CreateNeg(Y, Y->getName() + ".neg", false,
-                                                I.hasNoSignedWrap()),
-                              ConstantInt::getNullValue(Op0->getType()));
+    return SelectInst::Create(
+        X,
+        Builder.CreateNeg(Y, Y->getName() + ".neg", false, I.hasNoSignedWrap()),
+        ConstantInt::getNullValue(Op0->getType()));
 
   Constant *ImmC;
   if (match(Op1, m_ImmConstant(ImmC))) {

``````````

</details>


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


More information about the llvm-commits mailing list