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

via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 15 01:14:02 PST 2023


================
@@ -1544,6 +1544,14 @@ Instruction *InstCombinerImpl::visitSDiv(BinaryOperator &I) {
     }
   }
 
+  // -X / X --> X == INT_MIN ? 1 : -1
+  if ((match(Op0, m_Sub(m_Zero(), m_Value(X))) && match(Op1, m_Specific(X)))) {
----------------
Z572 wrote:

use isKnownNegation will crash

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


More information about the llvm-commits mailing list