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

Chad Rosier via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 10 09:21:52 PST 2017


mcrosier added a comment.

In https://reviews.llvm.org/D39830#921143, @escha wrote:

> what is the purpose of this transform?


The general assumption is that a FP addition will be less expensive than a FP multiply.

> why is the new form considered more canonical?

There was a bit of discussion in https://reviews.llvm.org/D32596 with respect to what is considered canonical form.  Basically, in IR reassociation and inst combine prefer the 2*a version primarily because this results in 'a' having a single use, which we generally optimize more aggressively than multiple uses.

Is there a particular case you're concerned about?


https://reviews.llvm.org/D39830





More information about the llvm-commits mailing list