diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-05-05 23:07:41 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-05-05 23:07:41 +0000 |
commit | 1b6f698e85b5087e22044d7214dae54fb509d147 (patch) | |
tree | 39b842e7611b98c232ec3b988ec74d6e4077b8e0 /llvm/lib/CodeGen | |
parent | eebc832f4390150b9b695467ad767b5c5950b178 (diff) | |
download | bcm5719-llvm-1b6f698e85b5087e22044d7214dae54fb509d147.tar.gz bcm5719-llvm-1b6f698e85b5087e22044d7214dae54fb509d147.zip |
Fix PR6520. An earlyclobber physreg must not be allocated to anything else.
llvm-svn: 103133
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/RegAllocLocal.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/RegAllocLocal.cpp b/llvm/lib/CodeGen/RegAllocLocal.cpp index 94456d14385..a3d2f9d2c2e 100644 --- a/llvm/lib/CodeGen/RegAllocLocal.cpp +++ b/llvm/lib/CodeGen/RegAllocLocal.cpp @@ -843,8 +843,18 @@ void RALocal::AllocateBasicBlock(MachineBasicBlock &MBB) { SmallVector<unsigned, 8> Kills; for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand &MO = MI->getOperand(i); - if (!MO.isReg() || !MO.isKill()) continue; - + if (!MO.isReg()) continue; + unsigned Reg = MO.getReg(); + if (!Reg) continue; + + // Avoid allocating assigned early clobbers below. + if (MO.isEarlyClobber() && TargetRegisterInfo::isPhysicalRegister(Reg)) { + spillPhysReg(MBB, MI, Reg, true); // Spill any existing value in reg + PhysRegsUsed[Reg] = 0; // It is free and reserved now + AddToPhysRegsUseOrder(Reg); + } + + if (!MO.isKill()) continue; if (!MO.isImplicit()) Kills.push_back(MO.getReg()); else if (!isReadModWriteImplicitKill(MI, MO.getReg())) |