[llvm-commits] [llvm] r119305 - in /llvm/trunk: lib/CodeGen/LiveIntervalAnalysis.cpp test/CodeGen/ARM/2010-11-15-SpillEarlyClobber.ll

Jakob Stoklund Olesen stoklund at 2pi.dk
Mon Nov 15 16:40:59 PST 2010


Author: stoklund
Date: Mon Nov 15 18:40:59 2010
New Revision: 119305

URL: http://llvm.org/viewvc/llvm-project?rev=119305&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
    llvm/trunk/test/CodeGen/ARM/2010-11-15-SpillEarlyClobber.ll

Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=119305&r1=119304&r2=119305&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Mon Nov 15 18:40:59 2010
@@ -1136,11 +1136,14 @@
       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 @@
       }
     }
     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);

Modified: llvm/trunk/test/CodeGen/ARM/2010-11-15-SpillEarlyClobber.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2010-11-15-SpillEarlyClobber.ll?rev=119305&r1=119304&r2=119305&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/2010-11-15-SpillEarlyClobber.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/2010-11-15-SpillEarlyClobber.ll Mon Nov 15 18:40:59 2010
@@ -1,3 +1,4 @@
+; RUN: llc < %s -verify-machineinstrs -spiller=standard
 ; RUN: llc < %s -verify-machineinstrs -spiller=inline
 ; PR8612
 ;





More information about the llvm-commits mailing list