[PATCH] D68408: [InstCombine] Negator - sink sinkable negations

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 5 15:02:59 PDT 2019


lebedev.ri updated this revision to Diff 223385.
lebedev.ri retitled this revision from "[InstCombine] Unfold `sub %x, %y` -> `add (sub 0, %y), %x` IFF `%y` can be freely negated" to "[InstCombine] Negator - sink sinkable negations".
lebedev.ri edited the summary of this revision.
lebedev.ri added a comment.
Herald added a subscriber: mgorny.

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

> 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.)
>
>
> I'm not really sure how more direct approach would look..


Okay so this is nowhere near polished-enough, but how about this?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68408

Files:
  llvm/lib/Transforms/InstCombine/CMakeLists.txt
  llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
  llvm/lib/Transforms/InstCombine/InstCombineInternal.h
  llvm/lib/Transforms/InstCombine/InstCombineNegator.cpp
  llvm/test/Transforms/InstCombine/mul.ll
  llvm/test/Transforms/InstCombine/sub-of-negatible.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68408.223385.patch
Type: text/x-patch
Size: 19524 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191005/c1948aa6/attachment.bin>


More information about the llvm-commits mailing list