[InstCombine] Move an optimization from foldICmpAndConstConst to foldICmpUsingKnownBits
authorCraig Topper <craig.topper@intel.com>
Mon, 25 Sep 2017 21:15:00 +0000 (21:15 +0000)
committerCraig Topper <craig.topper@intel.com>
Mon, 25 Sep 2017 21:15:00 +0000 (21:15 +0000)
commit30dc9797e9fd3328b4d816c5b740bb567d6fa230
tree8e14e5cc29eb9ba802e6c5ec7c024c1c2aca1f3b
parent5124a14d9c111f70bf8202879a2319cd9f0bb6d5
[InstCombine] Move an optimization from foldICmpAndConstConst to foldICmpUsingKnownBits

All this optimization cares about is knowing how many low bits of LHS is known to be zero and whether that means that the result is 0 or greater than the RHS constant. It doesn't matter where the zeros in the low bits came from. So we don't need to specifically look for an AND. Instead we can use known bits.

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

llvm-svn: 314153
llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp