Don't setCalleeSavedInfoValid() until spills are interted.

In a naked function, the flag is never set and getPristineRegs() returns an
empty list. That means naked functions are able to clobber callee saved
registers, but that is the whole point of naked functions.

This fixes PR4716.

llvm-svn: 79096
This commit is contained in:
Jakob Stoklund Olesen 2009-08-15 13:10:46 +00:00
parent db3f862b6f
commit 8f6660c417
2 changed files with 12 additions and 2 deletions

View File

@ -214,8 +214,6 @@ void PEI::calculateCalleeSavedRegisters(MachineFunction &Fn) {
}
}
FFI->setCalleeSavedInfoValid(true);
if (CSI.empty())
return; // Early exit if no callee saved registers are modified!
@ -274,6 +272,8 @@ void PEI::insertCSRSpillsAndRestores(MachineFunction &Fn) {
MachineFrameInfo *FFI = Fn.getFrameInfo();
const std::vector<CalleeSavedInfo> &CSI = FFI->getCalleeSavedInfo();
FFI->setCalleeSavedInfoValid(true);
// Early exit if no callee saved registers are modified!
if (CSI.empty())
return;

View File

@ -0,0 +1,10 @@
; RUN: llvm-as < %s | llc -march=arm
; PR4716
define arm_aapcscc void @_start() nounwind naked {
entry:
tail call arm_aapcscc void @exit(i32 undef) noreturn nounwind
unreachable
}
declare arm_aapcscc void @exit(i32) noreturn nounwind