1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 12:43:36 +01:00

[InstCombine] add test for shl demanded bits miscompile; NFC

PR50341
This commit is contained in:
Sanjay Patel 2021-05-14 12:45:40 -04:00
parent af64ca04f5
commit c9d2ef0f8c

View File

@ -84,3 +84,17 @@ define i32 @set_shl_mask(i32 %x, i32 %y) {
%r = and i32 %s, 65536
ret i32 %r
}
; PR50341
define i8 @must_drop_poison(i32 %x, i32 %y) {
; CHECK-LABEL: @must_drop_poison(
; CHECK-NEXT: [[S:%.*]] = shl nuw nsw i32 [[X:%.*]], [[Y:%.*]]
; CHECK-NEXT: [[T:%.*]] = trunc i32 [[S]] to i8
; CHECK-NEXT: ret i8 [[T]]
;
%a = and i32 %x, 255
%s = shl nuw nsw i32 %a, %y
%t = trunc i32 %s to i8
ret i8 %t
}