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 | 6a6328ba3d007b2e5a71131793179ef96d4bee7d (patch) | |
tree | 49d168fe0c3be7c59bcf5db9625b6674b3cc3063 /lib/CodeGen/RegAllocFast.cpp | |
parent | ab2d00863f105b671b5f0da60152e14f13e0a4b3 (diff) |
Don't bother spilling before a return
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103831 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegAllocFast.cpp')
-rw-r--r-- | lib/CodeGen/RegAllocFast.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/CodeGen/RegAllocFast.cpp b/lib/CodeGen/RegAllocFast.cpp index 651f010a71..2a66cb12d9 100644 --- a/lib/CodeGen/RegAllocFast.cpp +++ b/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 |