diff --git a/llvm/test/Transforms/InstCombine/shl-demand.ll b/llvm/test/Transforms/InstCombine/shl-demand.ll index f2e59a1c4fcc61..245c7033190705 100644 --- a/llvm/test/Transforms/InstCombine/shl-demand.ll +++ b/llvm/test/Transforms/InstCombine/shl-demand.ll @@ -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 +}