From e272be7c9a1e20c4671451f435c9d8ff16290ccc Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Thu, 12 Oct 2017 17:31:46 +0000 Subject: [ValueTracking] return zero when there's conflict in known bits of a shift (PR34838) Poison allows us to return a better result than undef. llvm-svn: 315595 --- llvm/test/Analysis/ValueTracking/known-signbit-shift.ll | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'llvm/test/Analysis/ValueTracking/known-signbit-shift.ll') diff --git a/llvm/test/Analysis/ValueTracking/known-signbit-shift.ll b/llvm/test/Analysis/ValueTracking/known-signbit-shift.ll index bf984cb7474..7e9f1c2e70c 100644 --- a/llvm/test/Analysis/ValueTracking/known-signbit-shift.ll +++ b/llvm/test/Analysis/ValueTracking/known-signbit-shift.ll @@ -27,28 +27,22 @@ define i1 @test_shift_negative(i32 %a, i32 %b) { } ; If sign bit is a known zero, it cannot be a known one. -; This test should not crash opt. +; This test should not crash opt. The shift produces poison. define i32 @test_no_sign_bit_conflict1(i1 %b) { ; CHECK-LABEL: @test_no_sign_bit_conflict1( -; CHECK-NEXT: entry: -; CHECK-NEXT: [[SEL:%.*]] = select i1 %b, i32 -2147221504, i32 -2147483648 -; CHECK-NEXT: ret i32 [[SEL]] +; CHECK-NEXT: ret i32 0 ; -entry: %sel = select i1 %b, i32 8193, i32 8192 %mul = shl nsw i32 %sel, 18 ret i32 %mul } ; If sign bit is a known one, it cannot be a known zero. -; This test should not crash opt. +; This test should not crash opt. The shift produces poison. define i32 @test_no_sign_bit_conflict2(i1 %b) { ; CHECK-LABEL: @test_no_sign_bit_conflict2( -; CHECK-NEXT: entry: -; CHECK-NEXT: [[SEL:%.*]] = select i1 %b, i32 2147221504, i32 2146959360 -; CHECK-NEXT: ret i32 [[SEL]] +; CHECK-NEXT: ret i32 0 ; -entry: %sel = select i1 %b, i32 -8193, i32 -8194 %mul = shl nsw i32 %sel, 18 ret i32 %mul -- cgit v1.2.3