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

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 13 02:57:53 PST 2023


================
@@ -1230,6 +1230,10 @@ 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;
----------------
dtcxzyw wrote:

It has been handled by `isKnownNegation`:
https://github.com/llvm/llvm-project/blob/a604c4b562e99470e397f050f1e8707f923ebed7/llvm/lib/Analysis/ValueTracking.cpp#L7610-L7615

I think the motivation of #69574 is to prove that `(a - b) / (b - a)` is non-zero.



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


More information about the llvm-commits mailing list