[PATCH] Fix unfortunate interaction between foldSelectICmpAnd and urem
David Majnemer
david.majnemer at gmail.com
Fri May 17 18:31:08 PDT 2013
We fail to convert a urem to an and if we have a select between two powers
of two.
The reason why is because it gets turned into (add (and (lshr V, C1), C2),
C2) and we can not tell that it is a power of two any more.
The most natural thing seems to be to teach isKnownToBeAPowerOfTwo that (X
& Y) + Y is a power of two or zero if Y is a power of two.
A patch is attached with a test case.
--
David Majnemer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130517/327f0ebb/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rem-select-powers-of-2.diff
Type: application/octet-stream
Size: 1583 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130517/327f0ebb/attachment.obj>
More information about the llvm-commits
mailing list