[llvm] r291008 - [AArch64] Fix over-eager early-exit in load-store combiner
Nirav Dave via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 4 13:21:46 PST 2017
Author: niravd
Date: Wed Jan 4 15:21:46 2017
New Revision: 291008
URL: http://llvm.org/viewvc/llvm-project?rev=291008&view=rev
Log:
[AArch64] Fix over-eager early-exit in load-store combiner
Fix early-exit analysis for memory operation pairing when operations are
not emitted in ascending order.
Reviewers: mcrosier, t.p.northover
Subscribers: aemerson, rengolin, llvm-commits
Differential Revision: https://reviews.llvm.org/D28251
Added:
llvm/trunk/test/CodeGen/AArch64/store_merge_pair_offset.ll
Modified:
llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
Modified: llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp?rev=291008&r1=291007&r2=291008&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp Wed Jan 4 15:21:46 2017
@@ -1470,6 +1470,9 @@ bool AArch64LoadStoreOpt::tryToPairLdStI
bool IsUnscaled = TII->isUnscaledLdSt(MI);
int Offset = getLdStOffsetOp(MI).getImm();
int OffsetStride = IsUnscaled ? getMemScale(MI) : 1;
+ // Allow one more for offset.
+ if (Offset > 0)
+ Offset -= OffsetStride;
if (!inBoundsForPair(IsUnscaled, Offset, OffsetStride))
return false;
Added: llvm/trunk/test/CodeGen/AArch64/store_merge_pair_offset.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/store_merge_pair_offset.ll?rev=291008&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/store_merge_pair_offset.ll (added)
+++ llvm/trunk/test/CodeGen/AArch64/store_merge_pair_offset.ll Wed Jan 4 15:21:46 2017
@@ -0,0 +1,12 @@
+; RUN: llc -mtriple=aarch64-linux-gnu -aarch64-enable-atomic-cfg-tidy=0 -disable-lsr -verify-machineinstrs -enable-misched=false -enable-post-misched=false -o - %s | FileCheck %s
+
+define i64 @test(i64* %a) nounwind {
+ ; CHECK: ldp x{{[0-9]+}}, x{{[0-9]+}}
+ ; CHECK-NOT: ldr
+ %p1 = getelementptr inbounds i64, i64* %a, i32 64
+ %tmp1 = load i64, i64* %p1, align 2
+ %p2 = getelementptr inbounds i64, i64* %a, i32 63
+ %tmp2 = load i64, i64* %p2, align 2
+ %tmp3 = add i64 %tmp1, %tmp2
+ ret i64 %tmp3
+}
More information about the llvm-commits
mailing list