[PATCH] Fix unfortunate interaction between foldSelectICmpAnd and urem
Benjamin Kramer
benny.kra at gmail.com
Sat May 18 11:25:46 PDT 2013
On 18.05.2013, at 03:31, David Majnemer <david.majnemer at gmail.com> wrote:
> 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.
Making isKnownToBeAPowerOfTwo smarter is definitely the right way to fix this problem. Patch LGTM.
- Ben
>
> A patch is attached with a test case.
>
> --
> David Majnemer
> <rem-select-powers-of-2.diff>
More information about the llvm-commits
mailing list