[PATCH] Teach InstCombine to simplify (A & ~B) in icmp
Duncan Sands
baldrick at free.fr
Fri Apr 12 04:10:24 PDT 2013
Hi David,
On 12/04/13 10:52, David Majnemer wrote:
> The attached patch can transform:
>
> (A & ~B) == 0 --> (A & B) != 0
> (A & ~B) != 0 --> (A & B) == 0
>
> if we can prove that A is definitely a power of 2.
>
> Last time I tried this (almost exactly four months ago), self hosted clang
> builds failed because of undefined behavior. Somewhere.
>
> I've tested this patch against a checkout that was compiled by a compiler that
> was compiled with this patch and it went fine.
>
> Tests that exercise both transforms are included.
LGTM.
Ciao, Duncan.
More information about the llvm-commits
mailing list