Improve the LiveInterval class to keep track of which machine instruction
[oota-llvm.git] / lib / CodeGen / LiveInterval.cpp
index b0f09297b3e298c09b5e37af5b420236c374de84..0a2483e481b5a064f85cdbf75b3f7ae274e59068 100644 (file)
@@ -388,7 +388,7 @@ void LiveInterval::join(LiveInterval &Other, unsigned CopyIdx) {
       I->ValId = MergedDstValIdx;
     else {
       unsigned &NV = Dst2SrcIdxMap[I->ValId];
-      if (NV == 0) NV = getNextValue();
+      if (NV == 0) NV = getNextValue(Other.getInstForValNum(I->ValId));
       I->ValId = NV;
     }
 
@@ -422,6 +422,20 @@ void LiveInterval::print(std::ostream &OS, const MRegisterInfo *MRI) const {
            E = ranges.end(); I != E; ++I)
     OS << *I;
   }
+  
+  // Print value number info.
+  if (NumValues) {
+    OS << "  ";
+    for (unsigned i = 0; i != NumValues; ++i) {
+      if (i) OS << " ";
+      OS << i << "@";
+      if (InstDefiningValue[i] == ~0U) {
+        OS << "?";
+      } else {
+        OS << InstDefiningValue[i];
+      }
+    }
+  }
 }
 
 void LiveInterval::dump() const {