From ef715972423a57febb7aa9b056d9bf6320e74817 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Fri, 29 Jul 2011 00:18:19 +0000 Subject: Make sure to correctly clear the exact/nuw/nsw flags off of shifts when they are combined together. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136435 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Transforms/InstCombine/shift.ll | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/Transforms/InstCombine/shift.ll b/test/Transforms/InstCombine/shift.ll index d9ac9cb..132d51a 100644 --- a/test/Transforms/InstCombine/shift.ll +++ b/test/Transforms/InstCombine/shift.ll @@ -525,5 +525,20 @@ define i32 @test43(i32 %a, i32 %b) nounwind { ; CHECK-NEXT: ret } - - +define i32 @test44(i32 %a) nounwind { + %y = shl nuw i32 %a, 1 + %z = shl i32 %y, 4 + ret i32 %z +; CHECK: @test44 +; CHECK-NEXT: %y = shl i32 %a, 5 +; CHECK-NEXT: ret i32 %y +} + +define i32 @test45(i32 %a) nounwind { + %y = lshr exact i32 %a, 1 + %z = lshr i32 %y, 4 + ret i32 %z +; CHECK: @test45 +; CHECK-NEXT: %y = lshr i32 %a, 5 +; CHECK-NEXT: ret i32 %y +} -- cgit v1.1