[llvm-commits] [llvm] r77182 - /llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp

Evan Cheng evan.cheng at apple.com
Sun Jul 26 21:18:06 PDT 2009


Author: evancheng
Date: Sun Jul 26 23:18:04 2009
New Revision: 77182

URL: http://llvm.org/viewvc/llvm-project?rev=77182&view=rev
Log:
If CPSR is modified but the def is dead, then it's ok to fold the load / store.

Modified:
    llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp

Modified: llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp?rev=77182&r1=77181&r2=77182&view=diff

==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMBaseInstrInfo.cpp Sun Jul 26 23:18:04 2009
@@ -681,7 +681,7 @@
   MachineInstr *NewMI = NULL;
   if (Opc == ARM::MOVr || Opc == ARM::t2MOVr) {
     // If it is updating CPSR, then it cannot be folded.
-    if (MI->getOperand(4).getReg() != ARM::CPSR) {
+    if (MI->getOperand(4).getReg() != ARM::CPSR || MI->getOperand(4).isDead()) {
       unsigned Pred = MI->getOperand(2).getImm();
       unsigned PredReg = MI->getOperand(3).getReg();
       if (OpNum == 0) { // move -> store
@@ -771,6 +771,7 @@
                                         MachineInstr* MI,
                                         const SmallVectorImpl<unsigned> &Ops,
                                         MachineInstr* LoadMI) const {
+  // FIXME
   return 0;
 }
 
@@ -782,7 +783,7 @@
   unsigned Opc = MI->getOpcode();
   if (Opc == ARM::MOVr || Opc == ARM::t2MOVr) {
     // If it is updating CPSR, then it cannot be folded.
-    return MI->getOperand(4).getReg() != ARM::CPSR;
+    return MI->getOperand(4).getReg() != ARM::CPSR ||MI->getOperand(4).isDead();
   } else if (Opc == ARM::FCPYS || Opc == ARM::FCPYD) {
     return true;
   } else if (Opc == ARM::VMOVD || Opc == ARM::VMOVQ) {





More information about the llvm-commits mailing list