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 | 51bfd452d5d748abc5e65b71b8f7213a13e10569 (patch) | |
tree | 254324d85398e40007cc5dc97d03ced6399ee0a4 /lib | |
parent | 08bbda3811dcd797943ca162f3799f2d52dc2f6b (diff) | |
download | external_llvm-51bfd452d5d748abc5e65b71b8f7213a13e10569.zip external_llvm-51bfd452d5d748abc5e65b71b8f7213a13e10569.tar.gz external_llvm-51bfd452d5d748abc5e65b71b8f7213a13e10569.tar.bz2 |
Fix PR6520. An earlyclobber physreg must not be allocated to anything else.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103133 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/RegAllocLocal.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/CodeGen/RegAllocLocal.cpp b/lib/CodeGen/RegAllocLocal.cpp index 94456d1..a3d2f9d 100644 --- a/lib/CodeGen/RegAllocLocal.cpp +++ b/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())) |