diff options
| author | Craig Topper <craig.topper@intel.com> | 2017-09-20 21:18:17 +0000 |
|---|---|---|
| committer | Craig Topper <craig.topper@intel.com> | 2017-09-20 21:18:17 +0000 |
| commit | 562bf99ee61dbc28901253590780981c45e38e72 (patch) | |
| tree | a31aa230492206272ba474b5e350a46baad110f5 /llvm/test/Transforms | |
| parent | 9b593a69385034e11afb41e87b4d4752e88aff37 (diff) | |
| download | bcm5719-llvm-562bf99ee61dbc28901253590780981c45e38e72.tar.gz bcm5719-llvm-562bf99ee61dbc28901253590780981c45e38e72.zip | |
[InstCombine] Handle (X & C2) < C1 --> (X & C2) == 0
We already did (X & C2) > C1 --> (X & C2) != 0, if any bit set in (X & C2) will produce a result greater than C1. But there is an equivalent inverse condition with <= C1 (which will be canonicalized to < C1+1)
Differential Revision: https://reviews.llvm.org/D38065
llvm-svn: 313819
Diffstat (limited to 'llvm/test/Transforms')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/icmp.ll | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/test/Transforms/InstCombine/icmp.ll b/llvm/test/Transforms/InstCombine/icmp.ll index 930bfdca74f..8bbc6c5c9e8 100644 --- a/llvm/test/Transforms/InstCombine/icmp.ll +++ b/llvm/test/Transforms/InstCombine/icmp.ll @@ -1141,7 +1141,7 @@ define i1 @test67(i32 %x) { define i1 @test67inverse(i32 %x) { ; CHECK-LABEL: @test67inverse( ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X:%.*]], 96 -; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[AND]], 32 +; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[AND]], 0 ; CHECK-NEXT: ret i1 [[CMP]] ; %and = and i32 %x, 127 @@ -1178,7 +1178,7 @@ define <2 x i1> @test67vec2(<2 x i32> %x) { define <2 x i1> @test67vecinverse(<2 x i32> %x) { ; CHECK-LABEL: @test67vecinverse( ; CHECK-NEXT: [[AND:%.*]] = and <2 x i32> [[X:%.*]], <i32 96, i32 96> -; CHECK-NEXT: [[CMP:%.*]] = icmp ult <2 x i32> [[AND]], <i32 32, i32 32> +; CHECK-NEXT: [[CMP:%.*]] = icmp eq <2 x i32> [[AND]], zeroinitializer ; CHECK-NEXT: ret <2 x i1> [[CMP]] ; %and = and <2 x i32> %x, <i32 96, i32 96> |

