diff options
| author | David Majnemer <david.majnemer@gmail.com> | 2016-06-19 06:14:56 +0000 |
|---|---|---|
| committer | David Majnemer <david.majnemer@gmail.com> | 2016-06-19 06:14:56 +0000 |
| commit | 3119599475c5f989f22e8591577777e2861f9296 (patch) | |
| tree | d38d47a5384a71aa2dad33881e913c26f744a392 /llvm/test/Transforms/LoadCombine/load-combine-negativegep.ll | |
| parent | 37ba54e5d7212a8e2bfd0c2d441e79fe2a1d72d1 (diff) | |
| download | bcm5719-llvm-3119599475c5f989f22e8591577777e2861f9296.tar.gz bcm5719-llvm-3119599475c5f989f22e8591577777e2861f9296.zip | |
[LoadCombine] Combine Loads formed from GEPS with negative indexes
Change the underlying offset and comparisons to use int64_t instead of
uint64_t.
Patch by River Riddle!
Differential Revision: http://reviews.llvm.org/D21499
llvm-svn: 273105
Diffstat (limited to 'llvm/test/Transforms/LoadCombine/load-combine-negativegep.ll')
| -rw-r--r-- | llvm/test/Transforms/LoadCombine/load-combine-negativegep.ll | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/test/Transforms/LoadCombine/load-combine-negativegep.ll b/llvm/test/Transforms/LoadCombine/load-combine-negativegep.ll new file mode 100644 index 00000000000..7c5700b4295 --- /dev/null +++ b/llvm/test/Transforms/LoadCombine/load-combine-negativegep.ll @@ -0,0 +1,19 @@ +; RUN: opt -basicaa -load-combine -S < %s | FileCheck %s +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +define i32 @Load_NegGep(i32* %i){ + %1 = getelementptr inbounds i32, i32* %i, i64 -1 + %2 = load i32, i32* %1, align 4 + %3 = load i32, i32* %i, align 4 + %4 = add nsw i32 %3, %2 + ret i32 %4 +; CHECK-LABEL: @Load_NegGep( +; CHECK: %[[load:.*]] = load i64 +; CHECK: %[[combine_extract_lo:.*]] = trunc i64 %[[load]] to i32 +; CHECK: %[[combine_extract_shift:.*]] = lshr i64 %[[load]], 32 +; CHECK: %[[combine_extract_hi:.*]] = trunc i64 %[[combine_extract_shift]] to i32 +; CHECK: %[[add:.*]] = add nsw i32 %[[combine_extract_hi]], %[[combine_extract_lo]] +} + + |

