[llvm-commits] [llvm] r117670 - /llvm/trunk/lib/CodeGen/LiveInterval.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Fri Oct 29 10:37:29 PDT 2010


Author: stoklund
Date: Fri Oct 29 12:37:29 2010
New Revision: 117670

URL: http://llvm.org/viewvc/llvm-project?rev=117670&view=rev
Log:
Teach ConnectedVNInfoEqClasses::Classify to deal with unused values.

We don't want unused values forming their own equivalence classes, so we lump
them all together in one class, and then merge them with the class of the last
used value.

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

Modified: llvm/trunk/lib/CodeGen/LiveInterval.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveInterval.cpp?rev=117670&r1=117669&r2=117670&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveInterval.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveInterval.cpp Fri Oct 29 12:37:29 2010
@@ -740,11 +740,20 @@
   for (unsigned i = 0, e = LI->getNumValNums(); i != e; ++i)
     eqClass_.push_back(i);
 
+  const VNInfo *used = 0, *unused = 0;
+
   // Determine connections.
   for (LiveInterval::const_vni_iterator I = LI->vni_begin(), E = LI->vni_end();
        I != E; ++I) {
     const VNInfo *VNI = *I;
-    assert(!VNI->isUnused() && "Cannot handle unused values");
+    // Group all unused values into one class.
+    if (VNI->isUnused()) {
+      if (unused)
+        Connect(unused->id, VNI->id);
+      unused = VNI;
+      continue;
+    }
+    used = VNI;
     if (VNI->isPHIDef()) {
       const MachineBasicBlock *MBB = lis_.getMBBFromIndex(VNI->def);
       assert(MBB && "Phi-def has no defining MBB");
@@ -762,6 +771,11 @@
         Connect(VNI->id, UVNI->id);
     }
   }
+
+  // Lump all the unused values in with the last used value.
+  if (used && unused)
+    Connect(used->id, unused->id);
+
   return Renumber();
 }
 





More information about the llvm-commits mailing list