diff options
| author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-11-16 00:40:59 +0000 |
|---|---|---|
| committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2010-11-16 00:40:59 +0000 |
| commit | e2b8858611a95b3b352051c7e847798e45bdc1b7 (patch) | |
| tree | d55f426d25ca59c3457c7422ff5964bf6f6d458f /llvm | |
| parent | bafdb73e79e63007d1316004710bcb0744f63b93 (diff) | |
| download | bcm5719-llvm-e2b8858611a95b3b352051c7e847798e45bdc1b7.tar.gz bcm5719-llvm-e2b8858611a95b3b352051c7e847798e45bdc1b7.zip | |
Fix PR8612 in the standard spiller, take two.
The live range of a register defined by an early clobber starts at the use slot,
not the def slot.
Except when it is an early clobber tied to a use operand. Then it starts at the
def slot like a standard def.
llvm-svn: 119305
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/CodeGen/LiveIntervalAnalysis.cpp | 9 | ||||
| -rw-r--r-- | llvm/test/CodeGen/ARM/2010-11-15-SpillEarlyClobber.ll | 1 |
2 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp index aa2f9658874..9b42012979f 100644 --- a/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp +++ b/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp @@ -1136,11 +1136,14 @@ rewriteInstructionForSpills(const LiveInterval &li, const VNInfo *VNI, rewriteImplicitOps(li, MI, NewVReg, vrm); // Reuse NewVReg for other reads. + bool HasEarlyClobber = false; for (unsigned j = 0, e = Ops.size(); j != e; ++j) { MachineOperand &mopj = MI->getOperand(Ops[j]); mopj.setReg(NewVReg); if (mopj.isImplicit()) rewriteImplicitOps(li, MI, NewVReg, vrm); + if (mopj.isEarlyClobber()) + HasEarlyClobber = true; } if (CreatedNewVReg) { @@ -1199,7 +1202,11 @@ rewriteInstructionForSpills(const LiveInterval &li, const VNInfo *VNI, } } if (HasDef) { - LiveRange LR(index.getDefIndex(), index.getStoreIndex(), + // An early clobber starts at the use slot, except for an early clobber + // tied to a use operand (yes, that is a thing). + LiveRange LR(HasEarlyClobber && !HasUse ? + index.getUseIndex() : index.getDefIndex(), + index.getStoreIndex(), nI.getNextValue(SlotIndex(), 0, VNInfoAllocator)); DEBUG(dbgs() << " +" << LR); nI.addRange(LR); diff --git a/llvm/test/CodeGen/ARM/2010-11-15-SpillEarlyClobber.ll b/llvm/test/CodeGen/ARM/2010-11-15-SpillEarlyClobber.ll index 046016aa3f3..04220949027 100644 --- a/llvm/test/CodeGen/ARM/2010-11-15-SpillEarlyClobber.ll +++ b/llvm/test/CodeGen/ARM/2010-11-15-SpillEarlyClobber.ll @@ -1,3 +1,4 @@ +; RUN: llc < %s -verify-machineinstrs -spiller=standard ; RUN: llc < %s -verify-machineinstrs -spiller=inline ; PR8612 ; |

