This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Bitreverse/Bswap: Allow ORs of base values
Needs ReviewPublic

Authored by jmolloy on Dec 14 2015, 7:49 AM.

Details

Reviewers
hfinkel
sbaranga
Summary

Previously, we'd only recognize bitreversals or byteswaps where the generated value starts off as zero:

int2_t b = 0;
if (a & 1) b |= 2;
if (a & 2) b |= 1;
return b;

But with not much work we can also support starting the generated value as the reversal value:

int2_t b = a;
if (a & 1) b |= 2;
if (a & 2) b |= 1;
return b;

Diff Detail

Repository
rL LLVM

Event Timeline

jmolloy updated this revision to Diff 42721.Dec 14 2015, 7:49 AM
jmolloy retitled this revision from to [InstCombine] Bitreverse/Bswap: Allow ORs of base values.
jmolloy updated this object.
jmolloy added reviewers: hfinkel, sbaranga, sanjoy.
jmolloy set the repository for this revision to rL LLVM.
jmolloy added subscribers: majnemer, llvm-commits.

Optimistic Christmas Season Ping!

jmolloy updated this revision to Diff 45182.Jan 18 2016, 7:11 AM

Updated diff to reflect the changes that have gone into trunk.

sanjoy resigned from this revision.Apr 17 2016, 10:18 PM
sanjoy removed a reviewer: sanjoy.

Resigning from old patch to get it off my queue. Feel free to add me back if this is revived at some point.

hfinkel added inline comments.Apr 26 2016, 11:29 AM
lib/Transforms/Utils/Local.cpp
1673

Why is there no else if A->Provider && IsIdentityTransform(A->Provenance)) here?