diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2012-01-05 11:05:55 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2012-01-05 11:05:55 +0000 |
commit | 62dfc511524b28a9411f62e19d48120066c1e41b (patch) | |
tree | cdc0710c458931e3ea07b911144a432eb2f734d3 /test/CodeGen/X86/shift-folding.ll | |
parent | 1e141a854e0ecaace5925039159daf9dd8426196 (diff) | |
download | llvm-62dfc511524b28a9411f62e19d48120066c1e41b.tar.gz llvm-62dfc511524b28a9411f62e19d48120066c1e41b.tar.bz2 llvm-62dfc511524b28a9411f62e19d48120066c1e41b.tar.xz |
Prevent a DAGCombine from firing where there are two uses of
a combined-away node and the result of the combine isn't substantially
smaller than the input, it's just canonicalized. This is the first part
of a significant (7%) performance gain for Snappy's hot decompression
loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147604 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/X86/shift-folding.ll')
-rw-r--r-- | test/CodeGen/X86/shift-folding.ll | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/CodeGen/X86/shift-folding.ll b/test/CodeGen/X86/shift-folding.ll index 7eac116e02..3ea601147b 100644 --- a/test/CodeGen/X86/shift-folding.ll +++ b/test/CodeGen/X86/shift-folding.ll @@ -48,3 +48,23 @@ entry: %tmp512 = lshr i32 %tmp4, 24 ret i32 %tmp512 } + +define i64 @test5(i16 %i, i32* %arr) { +; Ensure that we don't fold away shifts which have multiple uses, as they are +; just re-introduced for the second use. +; CHECK: test5: +; CHECK-NOT: shrl +; CHECK: shrl $11 +; CHECK-NOT: shrl +; CHECK: ret + +entry: + %i.zext = zext i16 %i to i32 + %index = lshr i32 %i.zext, 11 + %index.zext = zext i32 %index to i64 + %val.ptr = getelementptr inbounds i32* %arr, i64 %index.zext + %val = load i32* %val.ptr + %val.zext = zext i32 %val to i64 + %sum = add i64 %val.zext, %index.zext + ret i64 %sum +} |