diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-04-20 00:38:45 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-04-20 00:38:45 +0000 |
commit | eece9dc81cedf0cda5c356c180f60d91c99920fc (patch) | |
tree | 9e8581cf7f5da30f274c65bbcb4f0f94c3f9dd44 /test/Transforms/InstCombine/shift.ll | |
parent | 181b14797518e714e1b6112db849ca53192b8f23 (diff) | |
download | llvm-eece9dc81cedf0cda5c356c180f60d91c99920fc.tar.gz llvm-eece9dc81cedf0cda5c356c180f60d91c99920fc.tar.bz2 llvm-eece9dc81cedf0cda5c356c180f60d91c99920fc.tar.xz |
Revert r155136 "Defer some shl transforms to DAGCombine."
While the patch was perfect and defect free, it exposed a really nasty
bug in X86 SelectionDAG that caused an llc crash when compiling lencod.
I'll put the patch back in after fixing the SelectionDAG problem.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155181 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine/shift.ll')
-rw-r--r-- | test/Transforms/InstCombine/shift.ll | 59 |
1 files changed, 7 insertions, 52 deletions
diff --git a/test/Transforms/InstCombine/shift.ll b/test/Transforms/InstCombine/shift.ll index 25e708b7f5..52310e34e0 100644 --- a/test/Transforms/InstCombine/shift.ll +++ b/test/Transforms/InstCombine/shift.ll @@ -65,17 +65,8 @@ define i32 @test6(i32 %A) { ; CHECK: @test6 ; CHECK-NEXT: mul i32 %A, 6 ; CHECK-NEXT: ret i32 - %B = shl i32 %A, 1 ;; convert to an mul instruction - %C = mul i32 %B, 3 - ret i32 %C -} - -define i32 @test6a(i32 %A) { -; CHECK: @test6a -; CHECK-NEXT: mul i32 %A, 6 -; CHECK-NEXT: ret i32 - %B = mul i32 %A, 3 - %C = shl i32 %B, 1 ;; convert to an mul instruction + %B = shl i32 %A, 1 ;; convert to an mul instruction + %C = mul i32 %B, 3 ret i32 %C } @@ -106,9 +97,7 @@ define i8 @test9(i8 %A) { ret i8 %C } -;; This transformation is deferred to DAGCombine: ;; (A >> 7) << 7 === A & 128 -;; The shl may be valuable to scalar evolution. define i8 @test10(i8 %A) { ; CHECK: @test10 ; CHECK-NEXT: and i8 %A, -128 @@ -118,21 +107,11 @@ define i8 @test10(i8 %A) { ret i8 %C } -;; Allow the simplification when the lshr shift is exact. -define i8 @test10a(i8 %A) { -; CHECK: @test10a -; CHECK-NEXT: ret i8 %A - %B = lshr exact i8 %A, 7 - %C = shl i8 %B, 7 - ret i8 %C -} - -;; This transformation is deferred to DAGCombine: ;; (A >> 3) << 4 === (A & 0x1F) << 1 -;; The shl may be valuable to scalar evolution. define i8 @test11(i8 %A) { ; CHECK: @test11 -; CHECK: shl i8 +; CHECK-NEXT: mul i8 %A, 6 +; CHECK-NEXT: and i8 ; CHECK-NEXT: ret i8 %a = mul i8 %A, 3 ; <i8> [#uses=1] %B = lshr i8 %a, 3 ; <i8> [#uses=1] @@ -140,18 +119,6 @@ define i8 @test11(i8 %A) { ret i8 %C } -;; Allow the simplification in InstCombine when the lshr shift is exact. -define i8 @test11a(i8 %A) { -; CHECK: @test11a -; CHECK-NEXT: mul i8 %A, 6 -; CHECK-NEXT: ret i8 - %a = mul i8 %A, 3 - %B = lshr exact i8 %a, 3 - %C = shl i8 %B, 4 - ret i8 %C -} - -;; This is deferred to DAGCombine unless %B is single-use. ;; (A >> 8) << 8 === A & -256 define i32 @test12(i32 %A) { ; CHECK: @test12 @@ -162,12 +129,11 @@ define i32 @test12(i32 %A) { ret i32 %C } -;; This transformation is deferred to DAGCombine: ;; (A >> 3) << 4 === (A & -8) * 2 -;; The shl may be valuable to scalar evolution. define i8 @test13(i8 %A) { ; CHECK: @test13 -; CHECK: shl i8 +; CHECK-NEXT: mul i8 %A, 6 +; CHECK-NEXT: and i8 ; CHECK-NEXT: ret i8 %a = mul i8 %A, 3 ; <i8> [#uses=1] %B = ashr i8 %a, 3 ; <i8> [#uses=1] @@ -175,16 +141,6 @@ define i8 @test13(i8 %A) { ret i8 %C } -define i8 @test13a(i8 %A) { -; CHECK: @test13a -; CHECK-NEXT: mul i8 %A, 6 -; CHECK-NEXT: ret i8 - %a = mul i8 %A, 3 - %B = ashr exact i8 %a, 3 - %C = shl i8 %B, 4 - ret i8 %C -} - ;; D = ((B | 1234) << 4) === ((B << 4)|(1234 << 4) define i32 @test14(i32 %A) { ; CHECK: @test14 @@ -521,11 +477,10 @@ entry: %tmp49 = lshr i8 %tmp48, 5 %tmp50 = mul i8 %tmp49, 64 %tmp51 = xor i8 %tmp50, %tmp5 +; CHECK: and i8 %0, 16 %tmp52 = and i8 %tmp51, -128 %tmp53 = lshr i8 %tmp52, 7 -; CHECK: lshr i8 %tmp51, 7 %tmp54 = mul i8 %tmp53, 16 -; CHECK: shl nuw nsw i8 %tmp53, 4 %tmp55 = xor i8 %tmp54, %tmp51 ; CHECK: ret i8 %tmp551 ret i8 %tmp55 |