[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Feb 20 18:34:02 PST 2004


Changes in directory llvm/lib/Analysis/DataStructure:

BottomUpClosure.cpp updated: 1.76 -> 1.77

---
Log message:

Instead of cloning the globals for main into the globals graph at the end of 
BU propagation, clone the globals into the GG of EACH FUNCTION that finishes
processing!  The GlobalsGraph *must* include all globals and effects from
all functions in the program.  Fixing this makes pool allocation work better
on 175.vpr, but it still ultimately crashes.


---
Diffs of the changes:  (+11 -17)

Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp
diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.76 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.77
--- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.76	Fri Feb 20 17:52:14 2004
+++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp	Fri Feb 20 18:30:28 2004
@@ -57,23 +57,6 @@
 
   NumCallEdges += ActualCallees.size();
 
-
-  // At the end of the BU phase, clone the BU graph for main into the globals
-  // graph to make sure it has everything.
-  if (MainFunc) {
-    DSGraph &MainGraph = getOrCreateGraph(MainFunc);
-    DSScalarMap &MainSM = MainGraph.getScalarMap();
-    ReachabilityCloner RC(*GlobalsGraph, MainGraph, DSGraph::StripAllocaBit);
-
-    // Clone everything reachable from globals in the "main" graph into the
-    // globals graph.
-    for (DSScalarMap::global_iterator I = MainSM.global_begin(),
-           E = MainSM.global_end(); I != E; ++I) 
-      RC.getClonedNH(MainSM[*I]);
-
-
-  }
-
   // At the end of the bottom-up pass, the globals graph becomes complete.
   // FIXME: This is not the right way to do this, but it is sorta better than
   // nothing!  In particular, externally visible globals and unresolvable call
@@ -328,6 +311,17 @@
   // Delete dead nodes.  Treat globals that are unreachable but that can
   // reach live nodes as live.
   Graph.removeDeadNodes(DSGraph::KeepUnreachableGlobals);
+
+  // When this graph is finalized, clone the globals in the graph into the
+  // globals graph to make sure it has everything, from all graphs.
+  DSScalarMap &MainSM = Graph.getScalarMap();
+  ReachabilityCloner RC(*GlobalsGraph, Graph, DSGraph::StripAllocaBit);
+
+  // Clone everything reachable from globals in the "main" graph into the
+  // globals graph.
+  for (DSScalarMap::global_iterator I = MainSM.global_begin(),
+         E = MainSM.global_end(); I != E; ++I) 
+    RC.getClonedNH(MainSM[*I]);
 
   //Graph.writeGraphToFile(std::cerr, "bu_" + F.getName());
 }





More information about the llvm-commits mailing list