This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG] Teach computeKnownBits about ATOMIC_CMP_SWAP_WITH_SUCCESS boolean return value
ClosedPublic

Authored by uweigand on Jan 15 2018, 5:20 AM.

Details

Summary

The second return value of ATOMIC_CMP_SWAP_WITH_SUCCESS is known to be a boolean, and should therefore be treated by computeKnownBits just like the second return values of SMULO / UMULO.

(I don't have a stand-alone test case for this, but this patch is required to make a test case pass that I'll be adding with a follow-on SystemZ back-end patch.)

Diff Detail

Repository
rL LLVM

Event Timeline

uweigand created this revision.Jan 15 2018, 5:20 AM

(I don't have a stand-alone test case for this, but this patch is required to make a test case pass that I'll be adding with a follow-on SystemZ back-end patch.)

Do have you the follow up patch available that you could make dependent on this one to show the diff?

(I don't have a stand-alone test case for this, but this patch is required to make a test case pass that I'll be adding with a follow-on SystemZ back-end patch.)

Do have you the follow up patch available that you could make dependent on this one to show the diff?

I somehow wasn't able to create a dependent diff, but I uploaded the back-end patch (set) here:
https://reviews.llvm.org/D42115

Most of the new tests added to tests/SystemZ/cmpxchg-* will fail without this patch. In the end, this is because I want to fold tests of the success result of compare-and-swap operations into a conditional branch using the condition code set by the CSG instruction directly. But standard expansion in SelectionDAG for some reason always creates an AND with 1 when using the success result, and the presence of this AND messes up my pattern matchers. But with this patch, common code knows that this AND is redundant and we can get rid of it.

RKSimon accepted this revision.Jan 18 2018, 2:24 PM

LGTM - thanks.

This revision is now accepted and ready to land.Jan 18 2018, 2:24 PM
This revision was automatically updated to reflect the committed changes.