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

Chris Lattner lattner at cs.uiuc.edu
Sat Nov 9 15:01:01 PST 2002


Changes in directory llvm/lib/Analysis/DataStructure:

BottomUpClosure.cpp updated: 1.37 -> 1.38
DataStructure.cpp updated: 1.58 -> 1.59
Local.cpp updated: 1.34 -> 1.35
Steensgaard.cpp updated: 1.11 -> 1.12
TopDownClosure.cpp updated: 1.26 -> 1.27

---
Log message:

Clean up DSGraph::removeDeadNodes interface


---
Diffs of the changes:

Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp
diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.37 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.38
--- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.37	Sat Nov  9 14:55:24 2002
+++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp	Sat Nov  9 15:00:47 2002
@@ -150,15 +150,9 @@
     if (Inlined) {
       Graph->maskIncompleteMarkers();
       Graph->markIncompleteNodes();
-      Graph->removeDeadNodes(/*KeepAllGlobals*/ true, /*KeepCalls*/ true);
+      Graph->removeDeadNodes(/*KeepAllGlobals*/ true);
     }
   } while (Inlined && !FCs.empty());
-
-#if 0
-  Graph->maskIncompleteMarkers();
-  Graph->markIncompleteNodes();
-  Graph->removeDeadNodes(/*KeepAllGlobals*/ true, /*KeepCalls*/ true);
-#endif
 
   DEBUG(std::cerr << "  [BU] Done inlining: " << F.getName() << " ["
         << Graph->getGraphSize() << "+" << Graph->getFunctionCalls().size()


Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp
diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.58 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.59
--- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.58	Sat Nov  9 14:55:24 2002
+++ llvm/lib/Analysis/DataStructure/DataStructure.cpp	Sat Nov  9 15:00:47 2002
@@ -981,10 +981,7 @@
 // from the caller's graph entirely.  This is only appropriate to use when
 // inlining graphs.
 //
-void DSGraph::removeDeadNodes(bool KeepAllGlobals, bool KeepCalls) {
-  assert((!KeepAllGlobals || KeepCalls) &&  // FIXME: This should be an enum!
-         "KeepAllGlobals without KeepCalls is meaningless");
-
+void DSGraph::removeDeadNodes(bool KeepAllGlobals) {
   // Reduce the amount of work we have to do...
   removeTriviallyDeadNodes(KeepAllGlobals);
 
@@ -994,19 +991,17 @@
   std::set<DSNode*> Alive;
 
   // If KeepCalls, mark all nodes reachable by call nodes as alive...
-  if (KeepCalls) {
-    for (unsigned i = 0, e = FunctionCalls.size(); i != e; ++i) {
-      for (unsigned j = 0, e = FunctionCalls[i].getNumPtrArgs(); j != e; ++j)
-        markAlive(FunctionCalls[i].getPtrArg(j).getNode(), Alive);
-      markAlive(FunctionCalls[i].getRetVal().getNode(), Alive);
-      markAlive(FunctionCalls[i].getCallee().getNode(), Alive);
-    }
-    for (unsigned i = 0, e = AuxFunctionCalls.size(); i != e; ++i) {
-      for (unsigned j = 0, e = AuxFunctionCalls[i].getNumPtrArgs(); j != e; ++j)
-        markAlive(AuxFunctionCalls[i].getPtrArg(j).getNode(), Alive);
-      markAlive(AuxFunctionCalls[i].getRetVal().getNode(), Alive);
-      markAlive(AuxFunctionCalls[i].getCallee().getNode(), Alive);
-    }
+  for (unsigned i = 0, e = FunctionCalls.size(); i != e; ++i) {
+    for (unsigned j = 0, e = FunctionCalls[i].getNumPtrArgs(); j != e; ++j)
+      markAlive(FunctionCalls[i].getPtrArg(j).getNode(), Alive);
+    markAlive(FunctionCalls[i].getRetVal().getNode(), Alive);
+    markAlive(FunctionCalls[i].getCallee().getNode(), Alive);
+  }
+  for (unsigned i = 0, e = AuxFunctionCalls.size(); i != e; ++i) {
+    for (unsigned j = 0, e = AuxFunctionCalls[i].getNumPtrArgs(); j != e; ++j)
+      markAlive(AuxFunctionCalls[i].getPtrArg(j).getNode(), Alive);
+    markAlive(AuxFunctionCalls[i].getRetVal().getNode(), Alive);
+    markAlive(AuxFunctionCalls[i].getCallee().getNode(), Alive);
   }
 
   // Mark all nodes reachable by scalar nodes as alive...
@@ -1022,7 +1017,7 @@
   // Of course, if KeepAllGlobals is specified, they would be live already.
 
   if (!KeepAllGlobals)
-    markGlobalsAlive(*this, Alive, !KeepCalls);
+    markGlobalsAlive(*this, Alive, false);
 
   // Loop over all unreachable nodes, dropping their references...
   vector<DSNode*> DeadNodes;
@@ -1157,7 +1152,7 @@
   if (CloneCalls)
     GlobalsGraph->cloneCalls(Graph);
 
-  GlobalsGraph->removeDeadNodes(/*KeepAllGlobals*/ true, /*KeepCalls*/ true);
+  GlobalsGraph->removeDeadNodes(/*KeepAllGlobals*/ true);
 #endif
 }
 


Index: llvm/lib/Analysis/DataStructure/Local.cpp
diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.34 llvm/lib/Analysis/DataStructure/Local.cpp:1.35
--- llvm/lib/Analysis/DataStructure/Local.cpp:1.34	Sat Nov  9 14:55:24 2002
+++ llvm/lib/Analysis/DataStructure/Local.cpp	Sat Nov  9 15:00:47 2002
@@ -134,7 +134,7 @@
   markIncompleteNodes();
 
   // Remove any nodes made dead due to merging...
-  removeDeadNodes(true, true);
+  removeDeadNodes(true);
 }
 
 


Index: llvm/lib/Analysis/DataStructure/Steensgaard.cpp
diff -u llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.11 llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.12
--- llvm/lib/Analysis/DataStructure/Steensgaard.cpp:1.11	Sat Nov  9 14:55:24 2002
+++ llvm/lib/Analysis/DataStructure/Steensgaard.cpp	Sat Nov  9 15:00:47 2002
@@ -194,7 +194,7 @@
   ResultGraph->markIncompleteNodes(false);
 
   // Remove any nodes that are dead after all of the merging we have done...
-  ResultGraph->removeDeadNodes(true, true);
+  ResultGraph->removeDeadNodes(true);
 
   DEBUG(print(std::cerr, &M));
   return false;


Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp
diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.26 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.27
--- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.26	Sat Nov  9 14:55:24 2002
+++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp	Sat Nov  9 15:00:47 2002
@@ -180,8 +180,7 @@
       CG.maskIncompleteMarkers();
       CG.markIncompleteNodes(/*markFormals*/ !F.hasInternalLinkage()
                              /*&& FIXME: NEED TO CHECK IF ALL CALLERS FOUND!*/);
-      CG.removeDeadNodes(false, true) ;///*KeepAllGlobals*/ false, true);
-      ///*KeepCalls*/ false);
+      CG.removeDeadNodes(/*KeepAllGlobals*/ false);
     }
 
   DEBUG(std::cerr << "  [TD] Done inlining into callees for: " << F.getName()





More information about the llvm-commits mailing list