[PATCH] D75157: [DAGCombine] Perform the fold of A - (-B) -> A + B only when it is cheaper

qshanz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 26 02:34:33 PST 2020


steven.zhang added a comment.

In D75157#1892866 <https://reviews.llvm.org/D75157#1892866>, @lebedev.ri wrote:

> The test changes don't immediately stand out to me as improvements.
>  I'd think the fix should go in other direction.


Yes, no improvement as we know that it is neutral. And I don't see the improvement case also from the test change if we do this folding. Regarding to we only do the reverse folding when it is cheaper, I want to make them consistent to avoid the confusion no matter which direction. It is confusing that sometimes we do the folding if it is neutral and sometime not. The current implementation imply that, we prefer the "ADD" to "SUB". I am not sure that it is by the design as I don't see the reason for that. Welcome for any comments.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75157/new/

https://reviews.llvm.org/D75157





More information about the llvm-commits mailing list