[PATCH] D75157: [DAGCombine] Perform the fold of A - (-B) -> A + B only when it is cheaper
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 26 03:42:08 PST 2020
lebedev.ri added a comment.
In D75157#1892994 <https://reviews.llvm.org/D75157#1892994>, @steven.zhang wrote:
> 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.
That was my suggestion, yes. Change the other fold to be consistent with this one.
> 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".
That does sound sane to me, we certainly do have such a preference at least for integers, at least in middle-end.
> 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