[llvm] [InstCombine] simplify `(X * C0) / (X * C1)` into `C0 / C1`. (PR #73204)

via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 22 19:55:54 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 dc683d2e66de79bbea786f51788961eec5d0b793 83494b76fbe910797e7ecd3b629c594deccae146 -- 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 abbef95b43..74247129c6 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
@@ -1208,10 +1208,10 @@ Instruction *InstCombinerImpl::commonIDivTransforms(BinaryOperator &I) {
   }
 
   // (X*C0)/(X*C1) --> C0/C1
-  Constant *C0,*C1;
+  Constant *C0, *C1;
   if (match(Op0, m_c_Mul(m_Value(X), m_Constant(C0))) &&
       match(Op1, m_c_Mul(m_Specific(X), m_Constant(C1)))) {
-    auto OB0HasNSW=cast<OverflowingBinaryOperator>(Op0)->hasNoSignedWrap();
+    auto OB0HasNSW = cast<OverflowingBinaryOperator>(Op0)->hasNoSignedWrap();
     auto OB0HasNUW = cast<OverflowingBinaryOperator>(Op0)->hasNoUnsignedWrap();
     if ((IsSigned && OB0HasNSW) || (!IsSigned && OB0HasNUW)) {
       replaceOperand(I, 0, C0);

``````````

</details>


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


More information about the llvm-commits mailing list