[llvm] [InstCombine] Simplification for (-a * b) / (a * b). (PR #71768)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 14 06:08:57 PST 2023
================
@@ -1544,6 +1544,10 @@ Instruction *InstCombinerImpl::visitSDiv(BinaryOperator &I) {
}
}
+ // -(X * Y) / (X * Y) --> -1
+ if (isKnownNegation(Op0, Op1, true)) {
+ return replaceInstUsesWith(I, ConstantInt::getAllOnesValue(Ty));
+ };
----------------
dtcxzyw wrote:
```suggestion
```
It has been handled by `simplifySDivInst`.
https://github.com/llvm/llvm-project/blob/daddf402d9a4e3bacc37098d990e56dc9957ca3e/llvm/lib/Analysis/InstructionSimplify.cpp#L1230-L1232
https://github.com/llvm/llvm-project/pull/71768
More information about the llvm-commits
mailing list