[PATCH] D68408: [InstCombine] Unfold `sub %x, %y` -> `add (sub 0, %y), %x` IFF `%y` can be freely negated

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 4 14:40:13 PDT 2019


lebedev.ri added a comment.

In D68408#1695357 <https://reviews.llvm.org/D68408#1695357>, @efriedma wrote:

> > This *is* unusual. Is this too ugly to live?
>
> I'd prefer to actually transform the operation tree at the point we decide it's profitable, to make it clear we can't end up in an infinite loop or something like that.  As it is, you're depending on some other transforms happening in a particular order, and it's not clear that will happen consistently.  (Yes, it's a little more code, but I think that's okay.)


Actually, that's presicely why i believed this may be the best approach - we both avoid lot's of code duplication,
and if there are missing folds this *will* shake them loose - if they don't happen it'll "be caught" as a deadlock.

I'm not really sure how more direct approach would look..


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68408





More information about the llvm-commits mailing list