[llvm-commits] [poolalloc] r119010 - /poolalloc/trunk/lib/DSA/EquivClassGraphs.cpp

Arushi Aggarwal aggarwa4 at illinois.edu
Sat Nov 13 13:51:54 PST 2010


Author: aggarwa4
Date: Sat Nov 13 15:51:54 2010
New Revision: 119010

URL: http://llvm.org/viewvc/llvm-project?rev=119010&view=rev
Log:
Delete the original graphs, that are no longer in
use after merging in EQBU.

Modified:
    poolalloc/trunk/lib/DSA/EquivClassGraphs.cpp

Modified: poolalloc/trunk/lib/DSA/EquivClassGraphs.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/EquivClassGraphs.cpp?rev=119010&r1=119009&r2=119010&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/EquivClassGraphs.cpp (original)
+++ poolalloc/trunk/lib/DSA/EquivClassGraphs.cpp Sat Nov 13 15:51:54 2010
@@ -42,12 +42,33 @@
 bool EquivBUDataStructures::runOnModule(Module &M) {
   init(&getAnalysis<CompleteBUDataStructures>(), false, true, false, true);
 
+  //make a list of all the DSGraphs
+  std::list<DSGraph *>graphList;
+  for(Module::iterator F = M.begin(); F != M.end(); ++F) 
+  {
+    if(!(F->isDeclaration()))
+      graphList.push_back(getOrCreateGraph(F));
+  }
+
   //update the EQ class from indirect calls
   buildIndirectFunctionSets();
   mergeGraphsByGlobalECs();
+  
+  //remove all the DSGraph, that still have references
+  for(Module::iterator F = M.begin(); F != M.end(); ++F) 
+  {
+    if(!(F->isDeclaration()))
+      graphList.remove(getOrCreateGraph(F));
+  }
+  // free memory for the DSGraphs, no longer in use.
+  for(std::list<DSGraph*>::iterator i = graphList.begin(),e = graphList.end();
+      i!=e;i++) {
+    delete (*i);
+  }
 
   DEBUG(verifyMerging());
-  bool result = runOnModuleInternal(M);  
+  bool result = runOnModuleInternal(M); 
+  
   // CBU contains the correct call graph.
   // Restore it, so that subsequent passes and clients can get it.
   restoreCorrectCallGraph();





More information about the llvm-commits mailing list