[llvm] [InstCombine] Simplifiy `(-x * y * -x)` into `(x * y * x)` (PR #72953)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 21 00:50:45 PST 2023


================
@@ -351,6 +351,12 @@ Instruction *InstCombinerImpl::visitMul(BinaryOperator &I) {
   // X * -Y --> -(X * Y)
   if (match(&I, m_c_Mul(m_OneUse(m_Neg(m_Value(X))), m_Value(Y))))
     return BinaryOperator::CreateNeg(Builder.CreateMul(X, Y));
+  // (-X * Y) * -X --> (X * Y) * X
----------------
nikic wrote:

Add an empty line above here.

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


More information about the llvm-commits mailing list