[InstCombine] add test to show PR31260 miscompile; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289437 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Sanjay Patel 2016-12-12 15:28:44 +00:00
parent 650050c7c2
commit 3ca6ce4aa6

View File

@ -129,3 +129,37 @@ sw.bb2:
sw.default:
ret void
}
; FIXME: https://llvm.org/bugs/show_bug.cgi?id=31260
define i8 @PR31260(i8 %x) {
; ALL-LABEL: @PR31260(
; ALL-NEXT: entry:
; ALL-NEXT: [[T4:%.*]] = and i8 %x, 2
; ALL-NEXT: switch i8 [[T4]], label %exit [
; ALL-NEXT: i8 -128, label %case126
; ALL-NEXT: i8 -126, label %case124
; ALL-NEXT: ]
; ALL: exit:
; ALL-NEXT: ret i8 1
; ALL: case126:
; ALL-NEXT: ret i8 3
; ALL: case124:
; ALL-NEXT: ret i8 5
;
entry:
%t4 = and i8 %x, 2
%t5 = add nsw i8 %t4, -126
switch i8 %t5, label %exit [
i8 -126, label %case126
i8 -124, label %case124
]
exit:
ret i8 1
case126:
ret i8 3
case124:
ret i8 5
}