[llvm-commits] [llvm] r103831 - /llvm/trunk/lib/CodeGen/RegAllocFast.cpp
Jakob Stoklund Olesen
stoklund at 2pi.dk
Fri May 14 15:40:43 PDT 2010
Author: stoklund
Date: Fri May 14 17:40:43 2010
New Revision: 103831
URL: http://llvm.org/viewvc/llvm-project?rev=103831&view=rev
Log:
Don't bother spilling before a return
Modified:
llvm/trunk/lib/CodeGen/RegAllocFast.cpp
Modified: llvm/trunk/lib/CodeGen/RegAllocFast.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocFast.cpp?rev=103831&r1=103830&r2=103831&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegAllocFast.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegAllocFast.cpp Fri May 14 17:40:43 2010
@@ -768,11 +768,20 @@
// 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
More information about the llvm-commits
mailing list