Skip to content

Commit

Permalink
[NFC][InstCombine] Add shift amount reassociation miscompile example …
Browse files Browse the repository at this point in the history
…from PR44802

https://bugs.llvm.org/show_bug.cgi?id=44802
(cherry picked from commit 425ef99)
  • Loading branch information
LebedevRI authored and zmodem committed Feb 27, 2020
1 parent 3b6f4c5 commit 77e448c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions llvm/test/Transforms/InstCombine/shift-amount-reassociation.ll
Expand Up @@ -319,3 +319,18 @@ define i32 @n20(i32 %x, i32 %y) {
%t3 = shl i32 %t1, %t2
ret i32 %t3
}

; FIXME: this is a miscompile. We should not transform this.
; See https://bugs.llvm.org/show_bug.cgi?id=44802
define i3 @pr44802(i3 %t0) {
; CHECK-LABEL: @pr44802(
; CHECK-NEXT: [[T1:%.*]] = sub i3 0, [[T0:%.*]]
; CHECK-NEXT: ret i3 [[T1]]
;
%t1 = sub i3 0, %t0
%t2 = icmp ne i3 %t0, 0
%t3 = zext i1 %t2 to i3
%t4 = lshr i3 %t1, %t3
%t5 = lshr i3 %t4, %t3
ret i3 %t5
}

0 comments on commit 77e448c

Please sign in to comment.