aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2021-03-12 14:15:27 -0500
committerTom Stellard <tstellar@redhat.com>2021-03-30 14:28:11 -0700
commit5b3480610383ba281ef0c7918a6c097058a408d4 (patch)
treeebab754016c01d2858802d03e00446677014cf43
parent38dd45b00431e2c065e172751492e0ded59e49e6 (diff)
downloadllvm-5b3480610383ba281ef0c7918a6c097058a408d4.zip
llvm-5b3480610383ba281ef0c7918a6c097058a408d4.tar.gz
llvm-5b3480610383ba281ef0c7918a6c097058a408d4.tar.bz2
[InstCombine] add test for zext-of-icmps; NFC
PR49475 shows an infinite loop outcome, but this tries to show the root cause with a minimal test. (cherry picked from commit 579b8fc2e97c489308f97b01d13d894c03c0a16c)
-rw-r--r--llvm/test/Transforms/InstCombine/zext-or-icmp.ll20
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/zext-or-icmp.ll b/llvm/test/Transforms/InstCombine/zext-or-icmp.ll
index a77aa7a..54ae085 100644
--- a/llvm/test/Transforms/InstCombine/zext-or-icmp.ll
+++ b/llvm/test/Transforms/InstCombine/zext-or-icmp.ll
@@ -106,3 +106,23 @@ block2:
%conv2 = zext i1 %cmp1 to i32
ret i32 %conv2
}
+
+; FIXME: This should not end with more instructions than it started from.
+
+define i32 @PR49475(i32 %x, i16 %y) {
+; CHECK-LABEL: @PR49475(
+; CHECK-NEXT: [[M:%.*]] = and i16 [[Y:%.*]], 1
+; CHECK-NEXT: [[B1:%.*]] = icmp eq i32 [[X:%.*]], 0
+; CHECK-NEXT: [[B11:%.*]] = zext i1 [[B1]] to i32
+; CHECK-NEXT: [[TMP1:%.*]] = xor i16 [[M]], 1
+; CHECK-NEXT: [[TMP2:%.*]] = zext i16 [[TMP1]] to i32
+; CHECK-NEXT: [[Z3:%.*]] = or i32 [[B11]], [[TMP2]]
+; CHECK-NEXT: ret i32 [[Z3]]
+;
+ %m = and i16 %y, 1
+ %b1 = icmp eq i32 %x, 0
+ %b2 = icmp eq i16 %m, 0
+ %t1 = or i1 %b1, %b2
+ %z = zext i1 %t1 to i32
+ ret i32 %z
+}