[llvm-commits] [llvm] r124812 - /llvm/trunk/lib/CodeGen/SplitKit.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Thu Feb 3 12:29:36 PST 2011


Author: stoklund
Date: Thu Feb  3 14:29:36 2011
New Revision: 124812

URL: http://llvm.org/viewvc/llvm-project?rev=124812&view=rev
Log:
Fix coloring bug when mapping values in the middle of a live-through block.

If the found value is not live-through the block, we should only add liveness up
to the requested slot index. When the value is live-through, the whole block
should be colored.

Bug found by SSA verification in the machine code verifier.

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

Modified: llvm/trunk/lib/CodeGen/SplitKit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SplitKit.cpp?rev=124812&r1=124811&r2=124812&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SplitKit.cpp (original)
+++ llvm/trunk/lib/CodeGen/SplitKit.cpp Thu Feb  3 14:29:36 2011
@@ -607,14 +607,14 @@
   for (unsigned i = 0, e = LiveIn.size(); i != e; ++i) {
     MachineBasicBlock *MBB = LiveIn[i]->getBlock();
     SlotIndex Start = LIS.getMBBStartIdx(MBB);
-    if (MBB == IdxMBB) {
-      LI->addRange(LiveRange(Start, Idx.getNextSlot(), IdxVNI));
-      continue;
-    }
-    // Anything in LiveIn other than IdxMBB is live-through.
     VNInfo *VNI = LiveOutCache.lookup(MBB).first;
-    assert(VNI && "Missing block value");
-    LI->addRange(LiveRange(Start, LIS.getMBBEndIdx(MBB), VNI));
+
+    // Anything in LiveIn other than IdxMBB is live-through.
+    // In IdxMBB, we should stop at Idx unless the same value is live-out.
+    if (MBB == IdxMBB && IdxVNI != VNI)
+      LI->addRange(LiveRange(Start, Idx.getNextSlot(), IdxVNI));
+    else
+      LI->addRange(LiveRange(Start, LIS.getMBBEndIdx(MBB), VNI));
   }
 
   return IdxVNI;





More information about the llvm-commits mailing list