Skip to content

Commit 579b8fc

Browse files
committed
[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.
1 parent 2ea7014 commit 579b8fc

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

llvm/test/Transforms/InstCombine/zext-or-icmp.ll

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,23 @@ block2:
100100
%conv2 = zext i1 %cmp1 to i32
101101
ret i32 %conv2
102102
}
103+
104+
; FIXME: This should not end with more instructions than it started from.
105+
106+
define i32 @PR49475(i32 %x, i16 %y) {
107+
; CHECK-LABEL: @PR49475(
108+
; CHECK-NEXT: [[M:%.*]] = and i16 [[Y:%.*]], 1
109+
; CHECK-NEXT: [[B1:%.*]] = icmp eq i32 [[X:%.*]], 0
110+
; CHECK-NEXT: [[B11:%.*]] = zext i1 [[B1]] to i32
111+
; CHECK-NEXT: [[TMP1:%.*]] = xor i16 [[M]], 1
112+
; CHECK-NEXT: [[TMP2:%.*]] = zext i16 [[TMP1]] to i32
113+
; CHECK-NEXT: [[Z3:%.*]] = or i32 [[B11]], [[TMP2]]
114+
; CHECK-NEXT: ret i32 [[Z3]]
115+
;
116+
%m = and i16 %y, 1
117+
%b1 = icmp eq i32 %x, 0
118+
%b2 = icmp eq i16 %m, 0
119+
%t1 = or i1 %b1, %b2
120+
%z = zext i1 %t1 to i32
121+
ret i32 %z
122+
}

0 commit comments

Comments
 (0)