Page MenuHomePhabricator

[DAGCombine][X86][AArch64][AMDGPU] (x - y) + -1 -> add (xor y, -1), x fold
ClosedPublic

Authored by lebedev.ri on Wed, May 22, 10:30 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

lebedev.ri created this revision.Wed, May 22, 10:30 AM
lebedev.ri marked an inline comment as done.Wed, May 22, 10:32 AM
lebedev.ri added inline comments.
test/CodeGen/AMDGPU/llvm.amdgcn.s.barrier.ll
6 ↗(On Diff #200785)

@arsenm I believe D62263 recovers from changes here, somewhat, PTAL.

lebedev.ri marked an inline comment as done.
lebedev.ri added inline comments.
test/CodeGen/AMDGPU/llvm.amdgcn.s.barrier.ll
6 ↗(On Diff #200785)

Hmm, commented on the wrong patch, sorry :)

lebedev.ri edited the summary of this revision. (Show Details)Wed, May 22, 10:37 AM
RKSimon added inline comments.Thu, May 23, 8:19 AM
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
2941 ↗(On Diff #200785)

N1 == 1 not -1 ?

lebedev.ri planned changes to this revision.Thu, May 23, 8:56 AM
lebedev.ri marked an inline comment as done.
lebedev.ri added inline comments.
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
2941 ↗(On Diff #200785)

Uh, huh. I have no idea how i missed this.

lebedev.ri marked 2 inline comments as done.

Fix the fold (:

lib/CodeGen/SelectionDAG/DAGCombiner.cpp
2941 ↗(On Diff #200785)

I see what is going on.
I somehow copied it over from the one i'm adding to visitADDLike(), where it was correct, and did not notice.
The vector variant of (sub x, c) -> (add x, (sub 0, c)) is almost ready to be posted..

This revision is now accepted and ready to land.Thu, May 23, 10:53 AM
arsenm accepted this revision.Tue, May 28, 8:37 AM

LGTM. This should never be worse for AMDGPU

test/CodeGen/AMDGPU/llvm.amdgcn.s.barrier.ll
19–20 ↗(On Diff #201007)

This test shouldn't be relevant to this change, but I guess we're stuck with it for now

@RKSimon @arsenm thank you for the reviews!

Now that we know the amdgpu regression fix is ok, could someone please stamp D62223? :)

Rebased, NFC.

This revision was automatically updated to reflect the committed changes.
lebedev.ri reopened this revision.Tue, May 28, 12:04 PM

One of the patches seems to have introduced a hang in test-suite, reverted.

This revision is now accepted and ready to land.Tue, May 28, 12:04 PM
This revision was automatically updated to reflect the committed changes.
lebedev.ri reopened this revision.Thu, May 30, 9:05 AM

And once more.
rL362109 + rL362110

This revision is now accepted and ready to land.Thu, May 30, 9:05 AM
This revision was automatically updated to reflect the committed changes.