Don't let the memory allocator outsmart GVN. ;-)
authorOwen Anderson <resistor@mac.com>
Tue, 31 Jul 2007 23:27:13 +0000 (23:27 +0000)
committerOwen Anderson <resistor@mac.com>
Tue, 31 Jul 2007 23:27:13 +0000 (23:27 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40655 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/GVN.cpp

index ff66250244e8cf25a9129ae0b7b48c7f4b40608e..3d04fc4fd811f9215e8599a62a36eb9dae513f1e 100644 (file)
@@ -558,6 +558,11 @@ void ValueTable::clear() {
   nextValueNumber = 1;
 }
 
+/// erase - Remove a value from the value numbering
+void ValueTable::erase(Value* V) {
+  valueNumbering.erase(V);
+}
+
 //===----------------------------------------------------------------------===//
 //                       ValueNumberedSet Class
 //===----------------------------------------------------------------------===//
@@ -871,6 +876,7 @@ bool GVN::processInstruction(Instruction* I,
   if (currAvail.test(num)) {
     Value* repl = find_leader(currAvail, num);
     
+    VN.erase(I);
     I->replaceAllUsesWith(repl);
     toErase.push_back(I);
     return true;