summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2019-07-22 02:43:43 +0000
committerCraig Topper <craig.topper@intel.com>2019-07-22 02:43:43 +0000
commitee5dc7e7ad8b8ad6b28b374e151aadb97bd8031c (patch)
tree7fe5951a988c95c9c2da56b30d51b7f8cf9cb1a9 /llvm/test
parent3d68adebc579720a3914d50e77a413773be34f16 (diff)
downloadbcm5719-llvm-ee5dc7e7ad8b8ad6b28b374e151aadb97bd8031c.tar.gz
bcm5719-llvm-ee5dc7e7ad8b8ad6b28b374e151aadb97bd8031c.zip
[InstCombine] Add foldAndOfICmps test cases inspired by PR42691.
icmp ne %x, INT_MIN can be treated similarly to icmp sgt %x, INT_MIN. icmp ne %x, INT_MAX can be treated similarly to icmp slt %x, INT_MAX. icmp ne %x, UINT_MAX can be treated similarly to icmp ult %x, UINT_MAX. We already treat icmp ne %x, 0 similarly to icmp ugt %x, 0 llvm-svn: 366662
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/InstCombine/and-or-icmps.ll39
1 files changed, 39 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/and-or-icmps.ll b/llvm/test/Transforms/InstCombine/and-or-icmps.ll
index 60576d079f2..481e0f2fd20 100644
--- a/llvm/test/Transforms/InstCombine/and-or-icmps.ll
+++ b/llvm/test/Transforms/InstCombine/and-or-icmps.ll
@@ -338,3 +338,42 @@ define i1 @PR42691_7(i32 %x) {
%c = or i1 %c1, %c2
ret i1 %c
}
+
+define i1 @PR42691_8(i32 %x) {
+; CHECK-LABEL: @PR42691_8(
+; CHECK-NEXT: [[C1:%.*]] = icmp slt i32 %x, 14
+; CHECK-NEXT: [[C2:%.*]] = icmp ne i32 %x, -2147483648
+; CHECK-NEXT: [[C:%.*]] = and i1 [[C1]], [[C2]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %c1 = icmp slt i32 %x, 14
+ %c2 = icmp ne i32 %x, -2147483648
+ %c = and i1 %c1, %c2
+ ret i1 %c
+}
+
+define i1 @PR42691_9(i32 %x) {
+; CHECK-LABEL: @PR42691_9(
+; CHECK-NEXT: [[C1:%.*]] = icmp sgt i32 %x, 13
+; CHECK-NEXT: [[C2:%.*]] = icmp ne i32 %x, 2147483647
+; CHECK-NEXT: [[C:%.*]] = and i1 [[C1]], [[C2]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %c1 = icmp sgt i32 %x, 13
+ %c2 = icmp ne i32 %x, 2147483647
+ %c = and i1 %c1, %c2
+ ret i1 %c
+}
+
+define i1 @PR42691_10(i32 %x) {
+; CHECK-LABEL: @PR42691_10(
+; CHECK-NEXT: [[C1:%.*]] = icmp ugt i32 %x, 13
+; CHECK-NEXT: [[C2:%.*]] = icmp ne i32 %x, -1
+; CHECK-NEXT: [[C:%.*]] = and i1 [[C1]], [[C2]]
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %c1 = icmp ugt i32 %x, 13
+ %c2 = icmp ne i32 %x, 4294967295
+ %c = and i1 %c1, %c2
+ ret i1 %c
+}
OpenPOWER on IntegriCloud