Make sure the LR gets pushed in functions that use vaargs. This fixes
authorJim Grosbach <grosbach@apple.com>
Wed, 10 Mar 2010 20:01:30 +0000 (20:01 +0000)
committerJim Grosbach <grosbach@apple.com>
Wed, 10 Mar 2010 20:01:30 +0000 (20:01 +0000)
400.perlbench for the nightly tests.

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

lib/Target/ARM/ARMBaseRegisterInfo.cpp

index d9b8323f4ae1ded59afb169461f3e884d2d232c1..11e1c4862b414df1869fd3ae7f04a7de463277bc 100644 (file)
@@ -590,6 +590,10 @@ ARMBaseRegisterInfo::processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
       AFI->isThumb2Function())
     MF.getRegInfo().setPhysRegUsed(ARM::R4);
 
+  // Spill LR if Thumb1 function uses variable length argument lists.
+  if (AFI->isThumb1OnlyFunction() && AFI->getVarArgsRegSaveSize() > 0)
+    MF.getRegInfo().setPhysRegUsed(ARM::LR);
+
   // Don't spill FP if the frame can be eliminated. This is determined
   // by scanning the callee-save registers to see if any is used.
   const unsigned *CSRegs = getCalleeSavedRegs();