Skip to content

Commit 5b34806

Browse files
rotaterighttstellar
authored andcommitted
[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 579b8fc)
1 parent 38dd45b commit 5b34806

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
@@ -106,3 +106,23 @@ block2:
106106
%conv2 = zext i1 %cmp1 to i32
107107
ret i32 %conv2
108108
}
109+
110+
; FIXME: This should not end with more instructions than it started from.
111+
112+
define i32 @PR49475(i32 %x, i16 %y) {
113+
; CHECK-LABEL: @PR49475(
114+
; CHECK-NEXT: [[M:%.*]] = and i16 [[Y:%.*]], 1
115+
; CHECK-NEXT: [[B1:%.*]] = icmp eq i32 [[X:%.*]], 0
116+
; CHECK-NEXT: [[B11:%.*]] = zext i1 [[B1]] to i32
117+
; CHECK-NEXT: [[TMP1:%.*]] = xor i16 [[M]], 1
118+
; CHECK-NEXT: [[TMP2:%.*]] = zext i16 [[TMP1]] to i32
119+
; CHECK-NEXT: [[Z3:%.*]] = or i32 [[B11]], [[TMP2]]
120+
; CHECK-NEXT: ret i32 [[Z3]]
121+
;
122+
%m = and i16 %y, 1
123+
%b1 = icmp eq i32 %x, 0
124+
%b2 = icmp eq i16 %m, 0
125+
%t1 = or i1 %b1, %b2
126+
%z = zext i1 %t1 to i32
127+
ret i32 %z
128+
}

0 commit comments

Comments
 (0)