]> granicus.if.org Git - llvm/commit
[InstCombine] Simplify icmp ult/uge (shl %x, C2), C1 iff C1 is power of two -> icmp...
authorHuihui Zhang <huihuiz@quicinc.com>
Tue, 25 Jun 2019 20:44:52 +0000 (20:44 +0000)
committerHuihui Zhang <huihuiz@quicinc.com>
Tue, 25 Jun 2019 20:44:52 +0000 (20:44 +0000)
commitab07556fab4baef2e0d96fa190a8a99dac926073
treea0dd6a90804716631c5a07d840c8ab3a6eae0106
parent8e5ac908e973d5c1a0424793b4bc6e52cdbb85f0
[InstCombine] Simplify icmp ult/uge (shl %x, C2), C1 iff C1 is power of two -> icmp eq/ne (and %x, (lshr -C1, C2)), 0.

Simplify 'shl' inequality test into 'and' equality test.

This pattern happens in the middle-end while simplifying bitfield access,
Exposed in https://reviews.llvm.org/D63505

https://rise4fun.com/Alive/6uz

Reviewers: lebedev.ri, efriedma

Reviewed By: lebedev.ri

Subscribers: spatel, hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364348 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineCompares.cpp
test/Transforms/InstCombine/pr17827.ll
test/Transforms/InstCombine/shl-unsigned-cmp-const.ll