[llvm] [InstCombine] Simplification for (-a * b) / (a * b) and (a - b) / (b - a). (PR #71768)

via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 13 00:06:26 PST 2023


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 21861991e760e7e845dc1be5b804c950543d699a a4710e37b5faa56d19d83dbb1249252620579e51 -- llvm/lib/Analysis/InstructionSimplify.cpp llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index bbb79df988..3f670dc743 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -1230,7 +1230,7 @@ static Value *simplifySDivInst(Value *Op0, Value *Op1, bool IsExact,
   // If two operands are negated and no signed overflow, return -1.
   if (isKnownNegation(Op0, Op1, /*NeedNSW=*/true))
     return Constant::getAllOnesValue(Op0->getType());
-  Value *X,*Y;
+  Value *X, *Y;
   if (match(Op0, m_NSWSub(m_Value(Y), m_Value(X))) &&
       match(Op1, m_NSWSub(m_Specific(X), m_Specific(Y))))
     return Constant::getAllOnesValue(Op0->getType());
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
index b670d3e834..7780d478f0 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
@@ -1549,8 +1549,8 @@ Instruction *InstCombinerImpl::visitSDiv(BinaryOperator &I) {
        match(Op1, m_c_Mul(m_Specific(X), m_Specific(Y)))) ||
       (match(Op0, m_Mul(m_Value(X), m_Value(Y))) &&
        match(Op1, m_NSWNeg(m_c_Mul(m_Specific(X), m_Specific(Y)))))) {
-      return replaceInstUsesWith(I, ConstantInt::getAllOnesValue(Ty));
-    };
+    return replaceInstUsesWith(I, ConstantInt::getAllOnesValue(Ty));
+  };
   return nullptr;
 }
 

``````````

</details>


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


More information about the llvm-commits mailing list