[llvm] r185954 - ValueTracking: Fix bugs in isKnownToBeAPowerOfTwo

Sean Silva silvas at purdue.edu
Wed Jul 10 11:55:44 PDT 2013


On Wed, Jul 10, 2013 at 2:49 AM, Jay Foad <jay.foad at gmail.com> wrote:

> On 9 July 2013 19:11, David Majnemer <david.majnemer at gmail.com> wrote:
> > Author: majnemer
> > Date: Tue Jul  9 13:11:10 2013
> > New Revision: 185954
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=185954&view=rev
> > Log:
> > ValueTracking: Fix bugs in isKnownToBeAPowerOfTwo
> >
> > (add nsw x, (and x, y)) isn't a power of two if x is zero, it's zero
> > (add nsw x, (xor x, y)) isn't a power of two if y has bits set that
> aren't set in x
>
> Thanks! Please be very very careful not to introduce subtle
> mis-optimizations like this. If in doubt, get someone else to stare at
> the code before committing.
>

Another option is to use a theorem prover. I personally like <
http://rise4fun.com/z3py>, which is super easy to use.

-- Sean Silva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130710/e1cff23e/attachment.html>


More information about the llvm-commits mailing list