eliminate the ability to remove global nodes from deadNodeElminate... for now.
authorChris Lattner <sabre@nondot.org>
Sat, 9 Nov 2002 22:07:02 +0000 (22:07 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 9 Nov 2002 22:07:02 +0000 (22:07 +0000)
This slows stuff down a bit, but it should get much better before it gets any
worse.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4666 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/DSGraph.h
include/llvm/Analysis/DataStructure/DSGraph.h
lib/Analysis/DataStructure/BottomUpClosure.cpp
lib/Analysis/DataStructure/DataStructure.cpp
lib/Analysis/DataStructure/Local.cpp
lib/Analysis/DataStructure/Steensgaard.cpp
lib/Analysis/DataStructure/TopDownClosure.cpp

index 1c7f77fd23f0560ded30017baefa8c1eebe6db1e..1a4695ca2b0c053b6f4ea68546180080315b54df 100644 (file)
@@ -135,7 +135,7 @@ public:
   // from the caller's graph entirely.  This is only appropriate to use when
   // inlining graphs.
   //
-  void removeDeadNodes(bool KeepAllGlobals);
+  void removeDeadNodes();
 
   // CloneFlags enum - Bits that may be passed into the cloneInto method to
   // specify how to clone the function graph.
@@ -172,7 +172,7 @@ private:
   // merged with other nodes in the graph.  This is used as the first step of
   // removeDeadNodes.
   //
-  void removeTriviallyDeadNodes(bool KeepAllGlobals = false);
+  void removeTriviallyDeadNodes();
 };
 
 #endif
index 1c7f77fd23f0560ded30017baefa8c1eebe6db1e..1a4695ca2b0c053b6f4ea68546180080315b54df 100644 (file)
@@ -135,7 +135,7 @@ public:
   // from the caller's graph entirely.  This is only appropriate to use when
   // inlining graphs.
   //
-  void removeDeadNodes(bool KeepAllGlobals);
+  void removeDeadNodes();
 
   // CloneFlags enum - Bits that may be passed into the cloneInto method to
   // specify how to clone the function graph.
@@ -172,7 +172,7 @@ private:
   // merged with other nodes in the graph.  This is used as the first step of
   // removeDeadNodes.
   //
-  void removeTriviallyDeadNodes(bool KeepAllGlobals = false);
+  void removeTriviallyDeadNodes();
 };
 
 #endif
index ade6ca68a5c1be1a42f4c7d3e1bb0a79708b8843..c03e1c20e71cef976b8f5f6db2188e89f33daa73 100644 (file)
@@ -154,7 +154,7 @@ DSGraph &BUDataStructures::calculateGraph(Function &F) {
     if (Inlined) {
       Graph->maskIncompleteMarkers();
       Graph->markIncompleteNodes();
-      Graph->removeDeadNodes(/*KeepAllGlobals*/ true);
+      Graph->removeDeadNodes();
     }
   } while (Inlined && !FCs.empty());
 
index aab344bb99cecfd2628aee3a17c6b9cb80480f80..cc43544504f287f0c6a0f92f82682d25728dd642 100644 (file)
@@ -810,9 +810,9 @@ static void removeIdenticalCalls(vector<DSCallSite> &Calls,
 // other nodes in the graph.  These nodes will all be trivially unreachable, so
 // we don't have to perform any non-trivial analysis here.
 //
-void DSGraph::removeTriviallyDeadNodes(bool KeepAllGlobals) {
+void DSGraph::removeTriviallyDeadNodes() {
   for (unsigned i = 0; i != Nodes.size(); ++i)
-    if (!KeepAllGlobals || !(Nodes[i]->NodeType & DSNode::GlobalNode))
+    if (!(Nodes[i]->NodeType & DSNode::GlobalNode))
       if (isNodeDead(Nodes[i])) {               // This node is dead!
         delete Nodes[i];                        // Free memory...
         Nodes.erase(Nodes.begin()+i--);         // Remove from node list...
@@ -981,9 +981,9 @@ static void markGlobalsAlive(DSGraph &G, std::set<DSNode*> &Alive,
 // from the caller's graph entirely.  This is only appropriate to use when
 // inlining graphs.
 //
-void DSGraph::removeDeadNodes(bool KeepAllGlobals) {
+void DSGraph::removeDeadNodes() {
   // Reduce the amount of work we have to do...
-  removeTriviallyDeadNodes(KeepAllGlobals);
+  removeTriviallyDeadNodes();
 
   // FIXME: Merge nontrivially identical call nodes...
 
@@ -1012,13 +1012,6 @@ void DSGraph::removeDeadNodes(bool KeepAllGlobals) {
   // The return value is alive as well...
   markAlive(RetNode.getNode(), Alive);
 
-  // Mark all globals or cast nodes that can reach a live node as alive.
-  // This also marks all nodes reachable from such nodes as alive.
-  // Of course, if KeepAllGlobals is specified, they would be live already.
-
-  if (!KeepAllGlobals)
-    markGlobalsAlive(*this, Alive, false);
-
   // Loop over all unreachable nodes, dropping their references...
   vector<DSNode*> DeadNodes;
   DeadNodes.reserve(Nodes.size());     // Only one allocation is allowed.
@@ -1129,23 +1122,6 @@ DSNode* GlobalDSGraph::cloneNodeInto(DSNode *OldNode,
 }
 
 
-// GlobalDSGraph::cloneGlobals - Clone global nodes and all their externally
-// visible target links (and recursively their such links) into this graph.
-// 
-void GlobalDSGraph::cloneGlobals(DSGraph& Graph, bool CloneCalls) {
-  std::map<const DSNode*, DSNode*> NodeCache;
-#if 0
-  for (unsigned i = 0, N = Graph.Nodes.size(); i < N; ++i)
-    if (Graph.Nodes[i]->NodeType & DSNode::GlobalNode)
-      GlobalsGraph->cloneNodeInto(Graph.Nodes[i], NodeCache, false);
-  if (CloneCalls)
-    GlobalsGraph->cloneCalls(Graph);
-
-  GlobalsGraph->removeDeadNodes(/*KeepAllGlobals*/ true);
-#endif
-}
-
-
 // GlobalDSGraph::cloneCalls - Clone function calls and their visible target
 // links (and recursively their such links) into this graph.
 // 
index 311810644a450dfbff18889d5a4d912eb1c93547..427c54377bcb4aba6591a1e5ac4ad0ff76277a6e 100644 (file)
@@ -134,7 +134,7 @@ DSGraph::DSGraph(Function &F, DSGraph *GG) : Func(&F), GlobalsGraph(GG) {
   markIncompleteNodes();
 
   // Remove any nodes made dead due to merging...
-  removeDeadNodes(true);
+  removeDeadNodes();
 }
 
 
index 6dc2bda30be885c212c02443e16b070e13f47203..e42ef231761ea24358487f3def03043552bd0081 100644 (file)
@@ -194,7 +194,7 @@ bool Steens::run(Module &M) {
   ResultGraph->markIncompleteNodes(false);
 
   // Remove any nodes that are dead after all of the merging we have done...
-  ResultGraph->removeDeadNodes(true);
+  ResultGraph->removeDeadNodes();
 
   DEBUG(print(std::cerr, &M));
   return false;
index 1da43e5634ff81ae4b3a823d439d4235bf33188b..5c15b50f13aa7ee16410f8ed816372f2629b36f6 100644 (file)
@@ -186,7 +186,7 @@ void TDDataStructures::calculateGraph(Function &F) {
       CG.maskIncompleteMarkers();
       CG.markIncompleteNodes(/*markFormals*/ !F.hasInternalLinkage()
                              /*&& FIXME: NEED TO CHECK IF ALL CALLERS FOUND!*/);
-      CG.removeDeadNodes(/*KeepAllGlobals*/ false);
+      CG.removeDeadNodes();
     }
 
   DEBUG(std::cerr << "  [TD] Done inlining into callees for: " << F.getName()