Add globals graphs to all three passes


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4663 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/DataStructure/BottomUpClosure.cpp b/lib/Analysis/DataStructure/BottomUpClosure.cpp
index d57b618..ade6ca6 100644
--- a/lib/Analysis/DataStructure/BottomUpClosure.cpp
+++ b/lib/Analysis/DataStructure/BottomUpClosure.cpp
@@ -18,6 +18,18 @@
 
 using namespace DS;
 
+// run - Calculate the bottom up data structure graphs for each function in the
+// program.
+//
+bool BUDataStructures::run(Module &M) {
+  GlobalsGraph = new DSGraph();
+
+  // Simply calculate the graphs for each function...
+  for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
+    if (!I->isExternal())
+      calculateGraph(*I);
+  return false;
+}
 
 // releaseMemory - If the pass pipeline is done with this pass, we can release
 // our memory... here...
@@ -30,17 +42,8 @@
   // Empty map so next time memory is released, data structures are not
   // re-deleted.
   DSInfo.clear();
-}
-
-// run - Calculate the bottom up data structure graphs for each function in the
-// program.
-//
-bool BUDataStructures::run(Module &M) {
-  // Simply calculate the graphs for each function...
-  for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
-    if (!I->isExternal())
-      calculateGraph(*I);
-  return false;
+  delete GlobalsGraph;
+  GlobalsGraph = 0;
 }
 
 DSGraph &BUDataStructures::calculateGraph(Function &F) {
@@ -52,6 +55,7 @@
 
   // Copy the local version into DSInfo...
   Graph = new DSGraph(getAnalysis<LocalDataStructures>().getDSGraph(F));
+  Graph->setGlobalsGraph(GlobalsGraph);
 
 #if 0
   // Populate the GlobalsGraph with globals from this one.