summaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/icmp.ll
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2013-07-08 11:53:08 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2013-07-08 11:53:08 +0000
commit53fc39992df9c485ea45f28998c1ef99caed63f9 (patch)
tree1b423f8882c8064494312f2df66b31ba3dcf8c8b /test/Transforms/InstCombine/icmp.ll
parent4010110ccf21be0517034b6ccf9493628afaad77 (diff)
downloadllvm-53fc39992df9c485ea45f28998c1ef99caed63f9.tar.gz
llvm-53fc39992df9c485ea45f28998c1ef99caed63f9.tar.bz2
llvm-53fc39992df9c485ea45f28998c1ef99caed63f9.tar.xz
InstCombine: Fold X-C1 <u 2 -> (X & -2) == C1
Back in r179493 we determined that two transforms collided with each other. The fix back then was to reorder the transforms so that the preferred transform would give it a try and then we would try the secondary transform. However, it was noted that the best approach would canonicalize one transform into the other, removing the collision and allowing us to optimize IR given to us in that form. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185808 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine/icmp.ll')
-rw-r--r--test/Transforms/InstCombine/icmp.ll10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/icmp.ll b/test/Transforms/InstCombine/icmp.ll
index 929688195f..cf8305df2a 100644
--- a/test/Transforms/InstCombine/icmp.ll
+++ b/test/Transforms/InstCombine/icmp.ll
@@ -1113,3 +1113,13 @@ define i1 @or_icmp_eq_B_0_icmp_ult_A_B(i64 %a, i64 %b) {
%3 = or i1 %1, %2
ret i1 %3
}
+
+; CHECK: @icmp_add_ult_2
+; CHECK-NEXT: [[AND:%[a-z0-9]+]] = and i32 %X, -2
+; CHECK-NEXT: [[CMP:%[a-z0-9]+]] = icmp eq i32 [[AND]], 14
+; CHECK-NEXT: ret i1 [[CMP]]
+define i1 @icmp_add_ult_2(i32 %X) {
+ %add = add i32 %X, -14
+ %cmp = icmp ult i32 %add, 2
+ ret i1 %cmp
+}