[llvm-branch-commits] [llvm-branch] r226918 - Merging r226711:

Hans Wennborg hans at hanshq.net
Fri Jan 23 09:47:22 PST 2015


Author: hans
Date: Fri Jan 23 11:47:22 2015
New Revision: 226918

URL: http://llvm.org/viewvc/llvm-project?rev=226918&view=rev
Log:
Merging r226711:
------------------------------------------------------------------------
r226711 | jroelofs | 2015-01-21 14:39:43 -0800 (Wed, 21 Jan 2015) | 8 lines

Fix load-store optimizer on thumbv4t

Thumbv4t does not have lo->lo copies other than MOVS,
and that can't be predicated. So emit MOVS when needed
and bail if there's a predicate.

http://reviews.llvm.org/D6592

------------------------------------------------------------------------

Added:
    llvm/branches/release_36/test/CodeGen/ARM/2015-01-21-thumbv4t-ldstr-opt.ll
      - copied unchanged from r226711, llvm/trunk/test/CodeGen/ARM/2015-01-21-thumbv4t-ldstr-opt.ll
Modified:
    llvm/branches/release_36/   (props changed)
    llvm/branches/release_36/lib/Target/ARM/ARMLoadStoreOptimizer.cpp

Propchange: llvm/branches/release_36/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jan 23 11:47:22 2015
@@ -1,3 +1,3 @@
 /llvm/branches/Apple/Pertwee:110850,110961
 /llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,226023,226029,226044,226046,226048,226058,226075,226170-226171,226182,226473,226708,226755
+/llvm/trunk:155241,226023,226029,226044,226046,226048,226058,226075,226170-226171,226182,226473,226708,226711,226755

Modified: llvm/branches/release_36/lib/Target/ARM/ARMLoadStoreOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_36/lib/Target/ARM/ARMLoadStoreOptimizer.cpp?rev=226918&r1=226917&r2=226918&view=diff
==============================================================================
--- llvm/branches/release_36/lib/Target/ARM/ARMLoadStoreOptimizer.cpp (original)
+++ llvm/branches/release_36/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Fri Jan 23 11:47:22 2015
@@ -567,10 +567,21 @@ ARMLoadStoreOpt::MergeOps(MachineBasicBl
       //   MOV  NewBase, Base
       //   ADDS NewBase, #imm8.
       if (Base != NewBase && Offset >= 8) {
+        const ARMSubtarget &Subtarget = MBB.getParent()->getTarget()
+                       .getSubtarget<ARMSubtarget>();
         // Need to insert a MOV to the new base first.
-        BuildMI(MBB, MBBI, dl, TII->get(ARM::tMOVr), NewBase)
-          .addReg(Base, getKillRegState(BaseKill))
-          .addImm(Pred).addReg(PredReg);
+        if (isARMLowRegister(NewBase) && isARMLowRegister(Base) &&
+            !Subtarget.hasV6Ops()) {
+          // thumbv4t doesn't have lo->lo copies, and we can't predicate tMOVSr
+          if (Pred != ARMCC::AL)
+            return false;
+          BuildMI(MBB, MBBI, dl, TII->get(ARM::tMOVSr), NewBase)
+            .addReg(Base, getKillRegState(BaseKill));
+        } else
+          BuildMI(MBB, MBBI, dl, TII->get(ARM::tMOVr), NewBase)
+            .addReg(Base, getKillRegState(BaseKill))
+            .addImm(Pred).addReg(PredReg);
+
         // Set up BaseKill and Base correctly to insert the ADDS/SUBS below.
         Base = NewBase;
         BaseKill = false;





More information about the llvm-branch-commits mailing list