summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-08-27 22:53:44 +0000
committerChris Lattner <sabre@nondot.org>2010-08-27 22:53:44 +0000
commit6c1395f62ae1319143b77cf4fc15fe8b744aaf35 (patch)
treeba2d5d91647e469620121ae1a0c8abb07e996957 /llvm/test/Transforms
parent71cc9d886ada122bd82ed7d20325a98fa19390a3 (diff)
downloadbcm5719-llvm-6c1395f62ae1319143b77cf4fc15fe8b744aaf35.tar.gz
bcm5719-llvm-6c1395f62ae1319143b77cf4fc15fe8b744aaf35.zip
Enhance the shift propagator to handle the case when you have:
A = shl x, 42 ... B = lshr ..., 38 which can be transformed into: A = shl x, 4 ... iff we can prove that the would-be-shifted-in bits are already zero. This eliminates two shifts in the testcase and allows eliminate of the whole i128 chain in the real example. llvm-svn: 112314
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/InstCombine/shift.ll15
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/shift.ll b/llvm/test/Transforms/InstCombine/shift.ll
index 91a8ed7dda0..34e1835d74a 100644
--- a/llvm/test/Transforms/InstCombine/shift.ll
+++ b/llvm/test/Transforms/InstCombine/shift.ll
@@ -425,3 +425,18 @@ entry:
; CHECK: ret i128 %ins
}
+define i64 @test37(i128 %A, i32 %B) {
+entry:
+ %tmp27 = shl i128 %A, 64
+ %tmp22 = zext i32 %B to i128
+ %tmp23 = shl i128 %tmp22, 96
+ %ins = or i128 %tmp23, %tmp27
+ %tmp45 = lshr i128 %ins, 64
+ %tmp46 = trunc i128 %tmp45 to i64
+ ret i64 %tmp46
+
+; CHECK: %tmp23 = shl i128 %tmp22, 32
+; CHECK: %ins = or i128 %tmp23, %A
+; CHECK: %tmp46 = trunc i128 %ins to i64
+}
+
OpenPOWER on IntegriCloud