[llvm-commits] [poolalloc] r159067 - /poolalloc/trunk/lib/DSA/DSGraph.cpp

Will Dietz wdietz2 at illinois.edu
Fri Jun 22 19:57:01 PDT 2012


Author: wdietz2
Date: Fri Jun 22 21:57:00 2012
New Revision: 159067

URL: http://llvm.org/viewvc/llvm-project?rev=159067&view=rev
Log:
removeDeadNodes: Change AFC pruning algo to swap to end + single erase.

Performance and memory win across CINT2006 for the most part.

403.gcc is the only exception, going from 11s to 13s (460M -> 400M).
However others see significant improvements such as 400.perlbmk
which goes 6.6s -> 3.6s, 303M -> 192M.

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

Modified: poolalloc/trunk/lib/DSA/DSGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DSGraph.cpp?rev=159067&r1=159066&r2=159067&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DSGraph.cpp (original)
+++ poolalloc/trunk/lib/DSA/DSGraph.cpp Fri Jun 22 21:57:00 2012
@@ -1230,21 +1230,26 @@
       }
   } while (Iterate);
 
-  // Move dead aux function calls to the end of the list
-  for (FunctionListTy::iterator CI = AuxFunctionCalls.begin(),
-         E = AuxFunctionCalls.end(); CI != E; )
-    if (AuxFCallsAlive.count(&*CI))
-      ++CI;
-    else {
-      // Copy and merge global nodes and dead aux call nodes into the
-      // GlobalsGraph, and all nodes reachable from those nodes.  Update their
-      // target pointers using the GGCloner.
-      //
-      if (!(Flags & DSGraph::RemoveUnreachableGlobals))
-        GlobalsGraph->AuxFunctionCalls.push_back(DSCallSite(*CI, GGCloner));
+  // If only some of the aux calls are alive
+  if (AuxFCallsAlive.size() != AuxFunctionCalls.size()) {
+    // Move dead aux function calls to the end of the list
+    FunctionListTy::iterator Erase = AuxFunctionCalls.end();
+    for (FunctionListTy::iterator CI = AuxFunctionCalls.begin(); CI != Erase; )
+      if (AuxFCallsAlive.count(&*CI))
+        ++CI;
+      else {
+        // Copy and merge global nodes and dead aux call nodes into the
+        // GlobalsGraph, and all nodes reachable from those nodes.  Update their
+        // target pointers using the GGCloner.
+        //
+        if (!(Flags & DSGraph::RemoveUnreachableGlobals))
+          GlobalsGraph->AuxFunctionCalls.push_back(DSCallSite(*CI, GGCloner));
 
-      AuxFunctionCalls.erase(CI++);
-    }
+        std::swap(*CI, *--Erase);
+      }
+    AuxFunctionCalls.erase(Erase, AuxFunctionCalls.end());
+  }
+  AuxFCallsAlive.clear();
 
   // We are finally done with the GGCloner so we can destroy it.
   GGCloner.destroy();





More information about the llvm-commits mailing list