[llvm-commits] [poolalloc] r156370 - /poolalloc/trunk/lib/DSA/BottomUpClosure.cpp

Will Dietz wdietz2 at illinois.edu
Mon May 7 22:50:44 PDT 2012


Author: wdietz2
Date: Tue May  8 00:50:44 2012
New Revision: 156370

URL: http://llvm.org/viewvc/llvm-project?rev=156370&view=rev
Log:
Make CBU (and esp EQBU) much faster by not revisiting DSGraphs unnecessarily.

For now, just do this when looking for unvisited functions/graphs, although
this should be properly handled by calculateGraphs.  However this is
simpler and gets us quite the benefit by itself.

Hopefully will have time this all up properly later...

This trims EQBU on:
* 400.perlbmk: 409s => 9s (483s => 21s)
* 403.gcc: 82s => 16s (111s => 44s)
* 471.omnetpp: 161s => 22s (267s => 35s)

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

Modified: poolalloc/trunk/lib/DSA/BottomUpClosure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/BottomUpClosure.cpp?rev=156370&r1=156369&r2=156370&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/BottomUpClosure.cpp (original)
+++ poolalloc/trunk/lib/DSA/BottomUpClosure.cpp Tue May  8 00:50:44 2012
@@ -311,6 +311,21 @@
         << I->getName() << "\n");
       calculateGraphs(I, Stack, NextID, ValMap);     // Calculate all graphs.
       CloneAuxIntoGlobal(getDSGraph(*I));
+
+      // Mark this graph as processed.  Do this by finding all functions
+      // in the graph that map to it, and mark them visited.
+      // Note that this really should be handled neatly by calculateGraphs
+      // itself, not here.  However this catches the worst offenders.
+      DSGraph *G = getDSGraph(*I);
+      for(DSGraph::retnodes_iterator RI = G->retnodes_begin(),
+          RE = G->retnodes_end(); RI != RE; ++RI) {
+        if (getDSGraph(*RI->first) == G) {
+          if (!ValMap.count(RI->first))
+            ValMap[RI->first] = ~0U;
+          else
+            assert(ValMap[RI->first] == ~0U);
+        }
+      }
     }
   return;
 }
@@ -486,8 +501,6 @@
     }
     return MyID;
   }
-
-  return MyID;  // == Min
 }
 
   bool compareDSCallSites (const DSCallSite & DS1, const DSCallSite & DS2) {





More information about the llvm-commits mailing list