Teach isCSRestore() that ARM/Thumb2 functions will use post-modify LDR
authorJim Grosbach <grosbach@apple.com>
Fri, 10 Dec 2010 18:41:15 +0000 (18:41 +0000)
committerJim Grosbach <grosbach@apple.com>
Fri, 10 Dec 2010 18:41:15 +0000 (18:41 +0000)
instructions to restore a single register rather than an LDM instruction.
rdar://8754999

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121498 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMFrameInfo.cpp

index 71b60794f32fc5f5a291eddd500eb300af177335..e2efbd61fcd9a779d70346db60e7295f36ec325a 100644 (file)
@@ -92,6 +92,11 @@ static bool isCSRestore(MachineInstr *MI,
         return false;
     return true;
   }
+  if ((MI->getOpcode() == ARM::LDR_POST ||
+       MI->getOpcode() == ARM::t2LDR_POST) &&
+      isCalleeSavedRegister(MI->getOperand(0).getReg(), CSRegs) &&
+      MI->getOperand(1).getReg() == ARM::SP)
+    return true;
 
   return false;
 }