From c21a821e9f044004bc504dd7bfdfaecb9d4af16b Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Tue, 23 Nov 2010 20:33:57 +0000 Subject: The srem -> urem transform is not safe for any divisor that's not a power of two. E.g. -5 % 5 is 0 with srem and 1 with urem. Also addresses Frits van Bommel's comments. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120049 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Transforms/InstCombine/shift.ll | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/Transforms/InstCombine/shift.ll') diff --git a/test/Transforms/InstCombine/shift.ll b/test/Transforms/InstCombine/shift.ll index 6bebca9cc8..8d1c82991f 100644 --- a/test/Transforms/InstCombine/shift.ll +++ b/test/Transforms/InstCombine/shift.ll @@ -443,12 +443,12 @@ entry: } define i32 @test38(i32 %x) nounwind readnone { -entry: %rem = srem i32 %x, 32 %shl = shl i32 1, %rem ret i32 %shl ; CHECK: @test38 -; CHECK-NOT: srem -; CHECK: ret i32 +; CHECK-NEXT: and i32 %x, 31 +; CHECK-NEXT: shl i32 1 +; CHECK-NEXT: ret i32 } -- cgit v1.2.3