This is an archive of the discontinued LLVM Phabricator instance.

[Reassociate] Similar to "X + -X" -> "0", added code to handle "X + ~X" -> "-1".
ClosedPublic

Authored by rahul.jain on May 20 2014, 12:36 AM.

Details

Summary

Handle "X + ~X" -> "-1" in the function Value *Reassociate::OptimizeAdd(Instruction *I, SmallVectorImpl<ValueEntry> &Ops);
This patch implements:
TODO: We could handle "X + ~X" -> "-1" if we wanted, since "-X = ~X+1".

Diff Detail

Event Timeline

rahul.jain updated this revision to Diff 9596.May 20 2014, 12:36 AM
rahul.jain retitled this revision from to [Reassociate] Similar to "X + -X" -> "0", added code to handle "X + ~X" -> "-1"..
rahul.jain updated this object.
rahul.jain edited the test plan for this revision. (Show Details)
rahul.jain added a subscriber: Unknown Object (MLST).

Gentle ping.

Thanks,
Rahul

bkramer edited edge metadata.May 31 2014, 5:52 AM

I think this is fine. Do you need someone to commit it for you? If so, would you mind updating the patch without whitespace-only changes? They make the diff harder to read.

rahul.jain updated this revision to Diff 9984.May 31 2014, 8:02 AM
rahul.jain updated this object.
rahul.jain edited the test plan for this revision. (Show Details)
rahul.jain edited edge metadata.

Hi Benjamin,

Thanks for the review.
No I dont have commit access as of now, would be helpful if
you could commit it for me. Will request for one soon!

Updated patch removing the whitespace-only changes, those were
introduced on running clang-format.
Also patched to an updated revision.

Please commit it on my behalf.

Thanks again for the help!
Rahul

bkramer accepted this revision.May 31 2014, 8:09 AM
bkramer edited edge metadata.

OK, will commit.

This revision is now accepted and ready to land.May 31 2014, 8:09 AM
rahul.jain closed this revision.May 31 2014, 8:10 AM
rahul.jain updated this revision to Diff 9985.

Closed by commit rL209973 (authored by d0k).

Thanks Benjamin!

Thanks to Suyog Sarda for working with me on this!