[llvm-commits] [PATCH] Simplify negated bit test

Jakub Staszak kubastaszak at gmail.com
Tue Dec 11 02:14:21 PST 2012


You might also look at isPowerOfTwo function, and add a few test-cases
covered by it. Like this one:

// X & (-X) is always a power of two or zero.


Otherwise LGTM.
- Kuba


On Tue, Dec 11, 2012 at 12:15 AM, David Majnemer
<david.majnemer at gmail.com>wrote:

> Implemented, patch attached.
>
>
> On Mon, Dec 10, 2012 at 2:08 PM, Benjamin Kramer <benny.kra at gmail.com>wrote:
>
>> Instead of the shift matching "isPowerOfTwo" from ValueTracking.h could
>> be used to make the transformation more powerful. It handles the "1 << X"
>> case and many others too.
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121211/bfd7fc68/attachment.html>


More information about the llvm-commits mailing list