1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00

When inserting callee-save register reloads, make sure to skip over any

terminator instructions before the 'ret' in case the target has a
multi-instruction return sequence.

llvm-svn: 22041
This commit is contained in:
Chris Lattner 2005-05-15 03:09:58 +00:00
parent 64232a8480
commit 54bf1cc313

View File

@ -211,6 +211,14 @@ void PEI::saveCallerSavedRegisters(MachineFunction &Fn) {
MBB = FI;
I = MBB->end(); --I;
// Skip over all terminator instructions, which are part of the return
// sequence.
MachineBasicBlock::iterator I2 = I;
while (I2 != MBB->begin() && TII.isTerminatorInstr((--I2)->getOpcode()))
I = I2;
// Restore all registers immediately before the return and any terminators
// that preceed it.
for (unsigned i = 0, e = RegsToSave.size(); i != e; ++i) {
RegInfo->loadRegFromStackSlot(*MBB, I, RegsToSave[i], StackSlots[i]);
assert(I != MBB->begin() &&