Don't corrupt memory when removing an instruction from the program, but
not the worklist

llvm-svn: 6733
diff --git a/llvm/lib/Transforms/Scalar/GCSE.cpp b/llvm/lib/Transforms/Scalar/GCSE.cpp
index b467784..6883818 100644
--- a/llvm/lib/Transforms/Scalar/GCSE.cpp
+++ b/llvm/lib/Transforms/Scalar/GCSE.cpp
@@ -120,6 +120,7 @@
 
           // Erase the instruction from the program.
           I->getParent()->getInstList().erase(I);
+          WorkList.erase(I);
         }
       
       return true;