[llvm-commits] [llvm] r125116 - /llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Tue Feb 8 13:46:12 PST 2011


Author: stoklund
Date: Tue Feb  8 15:46:11 2011
New Revision: 125116

URL: http://llvm.org/viewvc/llvm-project?rev=125116&view=rev
Log:
Also handle the situation where an indirect branch is the first (and last)
instruction in a basic block.

Modified:
    llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp

Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp?rev=125116&r1=125115&r2=125116&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Tue Feb  8 15:46:11 2011
@@ -808,16 +808,18 @@
         DEBUG(dbgs() << ", uses at " << BI.LastUse << " after split point "
                      << BI.LastSplitPoint << ", stack-out.\n");
         SlotIndex SegEnd;
-        if (BI.LastSplitPoint == Start)
+        // Find the last real instruction before the split point.
+        MachineBasicBlock::iterator SplitI =
+          LIS->getInstructionFromIndex(BI.LastSplitPoint);
+        MachineBasicBlock::iterator I = SplitI, B = BI.MBB->begin();
+        while (I != B && (--I)->isDebugValue())
+          ;
+        if (I == SplitI)
           SegEnd = SE.leaveIntvAtTop(*BI.MBB);
         else {
-          MachineBasicBlock::iterator I =
-            LIS->getInstructionFromIndex(BI.LastSplitPoint);
-          do assert(I != BI.MBB->begin() && "Expected instruction");
-          while ((--I)->isDebugValue());
           SegEnd = SE.leaveIntvAfter(LIS->getInstructionIndex(I));
+          SE.useIntv(Start, SegEnd);
         }
-        SE.useIntv(Start, SegEnd);
         // Run a double interval from the split to the last use.
         // This makes it possible to spill the complement without affecting the
         // indirect branch.





More information about the llvm-commits mailing list