If we found a dead global, we should at least delete it...
authorChris Lattner <sabre@nondot.org>
Fri, 8 Oct 2004 22:05:31 +0000 (22:05 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 8 Oct 2004 22:05:31 +0000 (22:05 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16858 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/GlobalOpt.cpp

index 5c460539e18fe584b2e6093fcb137471f8c4dc59..dcbd87d566604983513c665fcaef249d54ad6a36 100644 (file)
@@ -364,6 +364,7 @@ static bool ProcessInternalGlobal(GlobalVariable *GV, Module::giterator &GVI) {
 
   if (GV->use_empty()) {
     DEBUG(std::cerr << "GLOBAL DEAD: " << *GV);
+    GV->getParent()->getGlobalList().erase(GV);
     ++NumDeleted;
     return true;
   }