[PATCH] D39830: [DAGCombine] Transform (A + -2.0*B*C) -> (A - (B+B)*C)

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 10 09:29:48 PST 2017


craig.topper added a comment.

This solution doesn't seem very general, it won't catch.

  double test2(double a, double b, double c, double d) {
    return a + -2.0*b*c*d;
  }

The constant can be many layers of multiplies away. Reassociate pushes constants down the tree. Should reassociate be pulling out the negate when it factors the tree?


https://reviews.llvm.org/D39830





More information about the llvm-commits mailing list