[llvm] [InstCombine] Simplifiy `(-x * y * -x)` into `(x * y * x)` (PR #72953)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 20 23:56:14 PST 2023
================
@@ -349,7 +349,7 @@ Instruction *InstCombinerImpl::visitMul(BinaryOperator &I) {
// -X * Y --> -(X * Y)
// X * -Y --> -(X * Y)
- if (match(&I, m_c_Mul(m_OneUse(m_Neg(m_Value(X))), m_Value(Y))))
----------------
goldsteinn wrote:
Think this will cause regressions if the `-x` is not used by a subsequent `mul`, but by some other independent instruction.
Maybe match the full pattern?
https://github.com/llvm/llvm-project/pull/72953
More information about the llvm-commits
mailing list