This is an archive of the discontinued LLVM Phabricator instance.

[TargetLowering] add special-case for demanded bits analysis of 'not'
ClosedPublic

Authored by spatel on Dec 2 2016, 10:48 AM.

Details

Summary

We treat bitwise 'not' as a special operation and try not to reduce its all-ones mask. Presumably, this is because a 'not' may be cheaper than a generic 'xor' or it may get folded into another logic op if the target has those. However, if we can remove a logic instruction by changing the xor's constant mask value, I think that's always a win.

Note that the IR version of SimplifyDemandedBits() does not treat 'not' as a special-case currently (although that's marked with a FIXME). So if you run this IR through -instcombine first, you should get the same result. But I'm hoping to add a different backend transform that will expose this problem, so I need to solve this first.

Diff Detail

Repository
rL LLVM

Event Timeline

spatel updated this revision to Diff 80094.Dec 2 2016, 10:48 AM
spatel retitled this revision from to [TargetLowering] add special-case for demanded bits analysis of 'not'.
spatel updated this object.
spatel added reviewers: efriedma, majnemer, zvi.
spatel added a subscriber: llvm-commits.
zvi accepted this revision.Dec 4 2016, 7:42 AM
zvi edited edge metadata.
This revision is now accepted and ready to land.Dec 4 2016, 7:42 AM
This revision was automatically updated to reflect the committed changes.