We might as well delete the known-dead global sooner rather than later since
authorChris Lattner <sabre@nondot.org>
Fri, 8 Oct 2004 20:25:55 +0000 (20:25 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 8 Oct 2004 20:25:55 +0000 (20:25 +0000)
we know it is dead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16855 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/GlobalOpt.cpp

index 402eead8b6b388ca4b3868118eb9167bb05bd0fd..b3edc9b8e4a48618c1f29eac1f696ad93ee48704 100644 (file)
@@ -316,6 +316,8 @@ static GlobalVariable *SRAGlobal(GlobalVariable *GV) {
     CE->destroyConstant();
   }
 
+  // Delete the old global, now that it is dead.
+  Globals.erase(GV);
   ++NumSRA;
   return NewGlobals[0];
 }