llvm.org GIT mirror llvm / d62c9a6
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79096 91177308-0d34-0410-b5e6-96231b3b80d8 Jakob Stoklund Olesen 10 years ago
2 changed file(s) with 12 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
213213 }
214214 }
215215
216 FFI->setCalleeSavedInfoValid(true);
217
218216 if (CSI.empty())
219217 return; // Early exit if no callee saved registers are modified!
220218
272270 // Get callee saved register information.
273271 MachineFrameInfo *FFI = Fn.getFrameInfo();
274272 const std::vector &CSI = FFI->getCalleeSavedInfo();
273
274 FFI->setCalleeSavedInfoValid(true);
275275
276276 // Early exit if no callee saved registers are modified!
277277 if (CSI.empty())
0 ; RUN: llvm-as < %s | llc -march=arm
1 ; PR4716
2
3 define arm_aapcscc void @_start() nounwind naked {
4 entry:
5 tail call arm_aapcscc void @exit(i32 undef) noreturn nounwind
6 unreachable
7 }
8
9 declare arm_aapcscc void @exit(i32) noreturn nounwind