[llvm-commits] [llvm] r72756 - in /llvm/trunk: lib/Target/ARM/ARMLoadStoreOptimizer.cpp test/CodeGen/ARM/str_pre-2.ll
Evan Cheng
evan.cheng at apple.com
Tue Jun 2 23:14:59 PDT 2009
Author: evancheng
Date: Wed Jun 3 01:14:58 2009
New Revision: 72756
URL: http://llvm.org/viewvc/llvm-project?rev=72756&view=rev
Log:
Fold preceding / trailing base inc / dec into the single load / store as well.
Added:
llvm/trunk/test/CodeGen/ARM/str_pre-2.ll
Modified:
llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp
Modified: llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp?rev=72756&r1=72755&r2=72756&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Wed Jun 3 01:14:58 2009
@@ -697,7 +697,7 @@
// LDM/STM ops.
for (unsigned i = 0, e = MBBII.size(); i < e; ++i)
if (mergeBaseUpdateLSMultiple(MBB, MBBII[i], Advance, MBBI))
- NumMerges++;
+ ++NumMerges;
NumMerges += MBBII.size();
// Try folding preceeding/trailing base inc/dec into those load/store
@@ -705,10 +705,17 @@
for (unsigned i = 0; i != NumMemOps; ++i)
if (!MemOps[i].Merged)
if (mergeBaseUpdateLoadStore(MBB, MemOps[i].MBBI, TII,Advance,MBBI))
- NumMerges++;
+ ++NumMerges;
// RS may be pointing to an instruction that's deleted.
RS->skipTo(prior(MBBI));
+ } else if (NumMemOps == 1) {
+ // Try folding preceeding/trailing base inc/dec into the single
+ // load/store.
+ if (mergeBaseUpdateLoadStore(MBB, MemOps[0].MBBI, TII, Advance, MBBI)) {
+ ++NumMerges;
+ RS->skipTo(prior(MBBI));
+ }
}
CurrBase = 0;
Added: llvm/trunk/test/CodeGen/ARM/str_pre-2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/str_pre-2.ll?rev=72756&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/str_pre-2.ll (added)
+++ llvm/trunk/test/CodeGen/ARM/str_pre-2.ll Wed Jun 3 01:14:58 2009
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | llc -mtriple=arm-linux-gnu | grep {str.*\\!}
+; RUN: llvm-as < %s | llc -mtriple=arm-linux-gnu | grep {ldr.*\\\[.*\], #+4}
+
+ at b = external global i64*
+
+define i64 @t(i64 %a) nounwind readonly {
+entry:
+ %0 = load i64** @b, align 4
+ %1 = load i64* %0, align 4
+ %2 = mul i64 %1, %a
+ ret i64 %2
+}
More information about the llvm-commits
mailing list