diff options
| author | Chris Lattner <sabre@nondot.org> | 2010-08-27 22:53:44 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2010-08-27 22:53:44 +0000 |
| commit | 5275ba2e7da02086fb9f757f14c5adf1e65a94ae (patch) | |
| tree | 409b539215f3192ae9c1676a89f5ffd5cbcfb8a1 /test/Transforms/InstCombine/shift.ll | |
| parent | 8cd320aab9573cbba94c7bcfdd33b43306fff024 (diff) | |
| download | external_llvm-5275ba2e7da02086fb9f757f14c5adf1e65a94ae.zip external_llvm-5275ba2e7da02086fb9f757f14c5adf1e65a94ae.tar.gz external_llvm-5275ba2e7da02086fb9f757f14c5adf1e65a94ae.tar.bz2 | |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112314 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine/shift.ll')
| -rw-r--r-- | test/Transforms/InstCombine/shift.ll | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/shift.ll b/test/Transforms/InstCombine/shift.ll index 91a8ed7..34e1835 100644 --- a/test/Transforms/InstCombine/shift.ll +++ b/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 +} + |
