diff options
| author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-05-14 22:40:43 +0000 |
|---|---|---|
| committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-05-14 22:40:43 +0000 |
| commit | 089e9421d2b8dc6fc03b5004cb3c8690a73d0ebc (patch) | |
| tree | 9a4c03fb91f5ca6aedb88039f8f7472dfd34f257 /llvm/lib/CodeGen/RegAllocFast.cpp | |
| parent | cdef6bc8de12cb4d02094a4a89a82277c0a5ff61 (diff) | |
| download | bcm5719-llvm-089e9421d2b8dc6fc03b5004cb3c8690a73d0ebc.tar.gz bcm5719-llvm-089e9421d2b8dc6fc03b5004cb3c8690a73d0ebc.zip | |
Don't bother spilling before a return
llvm-svn: 103831
Diffstat (limited to 'llvm/lib/CodeGen/RegAllocFast.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/RegAllocFast.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/RegAllocFast.cpp b/llvm/lib/CodeGen/RegAllocFast.cpp index 651f010a71e..2a66cb12d95 100644 --- a/llvm/lib/CodeGen/RegAllocFast.cpp +++ b/llvm/lib/CodeGen/RegAllocFast.cpp @@ -768,11 +768,20 @@ void RAFast::AllocateBasicBlock(MachineBasicBlock &MBB) { // Spill all physical registers holding virtual registers now. atEndOfBlock = true; - DEBUG(dbgs() << "Killing live registers at end of block.\n"); MachineBasicBlock::iterator MI = MBB.getFirstTerminator(); - for (LiveRegMap::iterator i = LiveVirtRegs.begin(), e = LiveVirtRegs.end(); - i != e; ++i) - spillVirtReg(MBB, MI, i, true); + if (MI != MBB.end() && MI->getDesc().isReturn()) { + // This is a return block, kill all virtual registers. + DEBUG(dbgs() << "Killing live registers at end of return block.\n"); + for (LiveRegMap::iterator i = LiveVirtRegs.begin(), e = LiveVirtRegs.end(); + i != e; ++i) + killVirtReg(i); + } else { + // This is a normal block, spill any dirty virtregs. + DEBUG(dbgs() << "Spilling live registers at end of block.\n"); + for (LiveRegMap::iterator i = LiveVirtRegs.begin(), e = LiveVirtRegs.end(); + i != e; ++i) + spillVirtReg(MBB, MI, i, true); + } LiveVirtRegs.clear(); // Erase all the coalesced copies. We are delaying it until now because |

