Fix PR8612 in the standard spiller as well.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Mon, 15 Nov 2010 20:55:53 +0000 (20:55 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Mon, 15 Nov 2010 20:55:53 +0000 (20:55 +0000)
The live range of a register defined by an early clobber starts at the use slot,
not the def slot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119183 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/LiveIntervalAnalysis.cpp
test/CodeGen/ARM/2010-11-15-SpillEarlyClobber.ll

index aa2f965887404881c4314bd351539286156d72a8..b77d43fe9a8080fbcb261547203cfb262a3648ca 100644 (file)
@@ -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,8 @@ rewriteInstructionForSpills(const LiveInterval &li, const VNInfo *VNI,
       }
     }
     if (HasDef) {
-      LiveRange LR(index.getDefIndex(), index.getStoreIndex(),
+      LiveRange LR(HasEarlyClobber ? index.getUseIndex() : index.getDefIndex(),
+                   index.getStoreIndex(),
                    nI.getNextValue(SlotIndex(), 0, VNInfoAllocator));
       DEBUG(dbgs() << " +" << LR);
       nI.addRange(LR);
index 046016aa3f3a9ddfb16de6ae83bc72505f951059..04220949027fb10e7ace8ae71dd27e6007f5647f 100644 (file)
@@ -1,3 +1,4 @@
+; RUN: llc < %s -verify-machineinstrs -spiller=standard
 ; RUN: llc < %s -verify-machineinstrs -spiller=inline
 ; PR8612
 ;