]> granicus.if.org Git - llvm/commit
[InstCombine] add fold for icmp with or mask of low bits (PR32542)
authorSanjay Patel <spatel@rotateright.com>
Wed, 5 Apr 2017 17:57:05 +0000 (17:57 +0000)
committerSanjay Patel <spatel@rotateright.com>
Wed, 5 Apr 2017 17:57:05 +0000 (17:57 +0000)
commitbcca3be4b549ec3eaae7091d0d8e5513273cad97
treea13d832fd99227116df7108c121dcabe1cfa2a1f
parent5acb804311d517730ebd8bf9ed3d553e3710228a
[InstCombine] add fold for icmp with or mask of low bits (PR32542)

We already have these 'and' folds:

// X & -C == -C -> X >  u ~C
// X & -C != -C -> X <= u ~C
//   iff C is a power of 2

...but we were missing the 'or' siblings.

http://rise4fun.com/Alive/n6

This should improve:
https://bugs.llvm.org/show_bug.cgi?id=32524
...but there are 2 or more other pieces to fix still.

Differential Revision: https://reviews.llvm.org/D31712

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299570 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineCompares.cpp
test/Transforms/InstCombine/icmp.ll