If "These should be used only by the auto-parallelization pass", we might as
[oota-llvm.git] / lib / Analysis / DataStructure / BottomUpClosure.cpp
index e2d6f6f0f426bd51d1be564fca26eada70d1fcd1..dd141f2daf697d1af5bcd9a29fb6c16a9bd80428 100644 (file)
 #include "llvm/Analysis/DataStructure.h"
 #include "llvm/Module.h"
 #include "Support/Statistic.h"
+#include "Support/Debug.h"
 #include "DSCallSiteIterator.h"
 
 namespace {
   Statistic<> MaxSCC("budatastructure", "Maximum SCC Size in Call Graph");
   Statistic<> NumBUInlines("budatastructures", "Number of graphs inlined");
+  Statistic<> NumCallEdges("budatastructures", "Number of 'actual' call edges");
   
   RegisterAnalysis<BUDataStructures>
   X("budatastructure", "Bottom-up Data Structure Analysis");
@@ -44,6 +46,8 @@ bool BUDataStructures::run(Module &M) {
 #endif
       calculateReachableGraphs(I);    // Calculate all graphs...
     }
+
+  NumCallEdges += ActualCallees.size();
   return false;
 }
 
@@ -280,11 +284,17 @@ void BUDataStructures::calculateGraph(DSGraph &Graph) {
 
   TempFCs.clear();
 
-  // Recompute the Incomplete markers.  If there are any function calls left
-  // now that are complete, we must loop!
+  // Re-materialize nodes from the globals graph.
+  // Do not ignore globals inlined from callees -- they are not up-to-date!
+  Graph.getInlinedGlobals().clear();
+  Graph.updateFromGlobalGraph();
+
+  // Recompute the Incomplete markers
   Graph.maskIncompleteMarkers();
   Graph.markIncompleteNodes(DSGraph::MarkFormalArgs);
-  // FIXME: materialize nodes from the globals graph as neccesary...
+
+  // Delete dead nodes.  Treat globals that are unreachable but that can
+  // reach live nodes as live.
   Graph.removeDeadNodes(DSGraph::KeepUnreachableGlobals);
 
   //Graph.writeGraphToFile(std::cerr, "bu_" + F.getName());