Skip to content

Commit 425ef99

Browse files
committed
[NFC][InstCombine] Add shift amount reassociation miscompile example from PR44802
https://bugs.llvm.org/show_bug.cgi?id=44802
1 parent fc466f8 commit 425ef99

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

llvm/test/Transforms/InstCombine/shift-amount-reassociation.ll

+15
Original file line numberDiff line numberDiff line change
@@ -319,3 +319,18 @@ define i32 @n20(i32 %x, i32 %y) {
319319
%t3 = shl i32 %t1, %t2
320320
ret i32 %t3
321321
}
322+
323+
; FIXME: this is a miscompile. We should not transform this.
324+
; See https://bugs.llvm.org/show_bug.cgi?id=44802
325+
define i3 @pr44802(i3 %t0) {
326+
; CHECK-LABEL: @pr44802(
327+
; CHECK-NEXT: [[T1:%.*]] = sub i3 0, [[T0:%.*]]
328+
; CHECK-NEXT: ret i3 [[T1]]
329+
;
330+
%t1 = sub i3 0, %t0
331+
%t2 = icmp ne i3 %t0, 0
332+
%t3 = zext i1 %t2 to i3
333+
%t4 = lshr i3 %t1, %t3
334+
%t5 = lshr i3 %t4, %t3
335+
ret i3 %t5
336+
}

0 commit comments

Comments
 (0)