This is an archive of the discontinued LLVM Phabricator instance.

Added inst combine transforms for single bit tests from Chris's note
ClosedPublic

Authored by dinesh.d on May 11 2014, 4:42 AM.

Details

Summary

This patch adds transforms for

if ((x & C) == 0) x |= C becomes x |= C
if ((x & C) != 0) x ^= C becomes x &= ~C
if ((x & C) == 0) x ^= C becomes x |= C
if ((x & C) != 0) x &= ~C becomes x &= ~C
if ((x & C) == 0) x &= ~C becomes nothing

Z3 Verifications code for above transform
http://rise4fun.com/Z3/Pmsh

Diff Detail

Event Timeline

dinesh.d updated this revision to Diff 9290.May 11 2014, 4:42 AM
dinesh.d retitled this revision from to Added inst combine transforms for single bit tests from Chris's note.
dinesh.d updated this object.
dinesh.d edited the test plan for this revision. (Show Details)
dinesh.d added reviewers: rafael, bkramer.
dinesh.d updated this object.
dinesh.d added a subscriber: Unknown Object (MLST).

You seem to be creating SelectInst instructions with the same Value for both the true and false arms. Instead, why not just return the Value?

dinesh.d updated this revision to Diff 9298.May 11 2014, 10:18 PM

oh, silly mistake, updated patch to return Value directly.

dinesh.d updated this revision to Diff 9300.May 11 2014, 10:20 PM

fixed one formatting issue

bkramer accepted this revision.May 14 2014, 8:55 AM
bkramer edited edge metadata.

This looks good now.

This revision is now accepted and ready to land.May 14 2014, 8:55 AM
dinesh.d closed this revision.May 14 2014, 11:11 PM

Submitted as r208848.

Thanks for review and support.