When replacing value numbers, make sure to compactify the value # space.
authorChris Lattner <sabre@nondot.org>
Thu, 24 Aug 2006 23:22:59 +0000 (23:22 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 24 Aug 2006 23:22:59 +0000 (23:22 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29865 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/LiveInterval.cpp

index a8c01daf4170d11dd84ed263ec767123e6488ce3..4752b6df51389d1870414b073794b10cf4eaee94 100644 (file)
@@ -470,6 +470,18 @@ void LiveInterval::MergeValueNumberInto(unsigned V1, unsigned V2) {
       }
     }
   }
+  
+  // Now that V1 is dead, remove it.  If it is the largest value number, just
+  // nuke it (and any other deleted values neighboring it), otherwise mark it as
+  // ~1U so it can be nuked later.
+  if (V1 == NumValues-1) {
+    do {
+      InstDefiningValue.pop_back();
+      --NumValues;
+    } while (InstDefiningValue.back() == ~1U);
+  } else {
+    InstDefiningValue[V1] = ~1U;
+  }
 }