Make removeTriviallyDeadNodes a private interface of DSGraph
authorChris Lattner <sabre@nondot.org>
Sat, 9 Nov 2002 20:55:24 +0000 (20:55 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 9 Nov 2002 20:55:24 +0000 (20:55 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4659 91177308-0d34-0410-b5e6-96231b3b80d8

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 ec9e0db9e48a6a5451a03e6acd9b509ae8c2f286..1a3f48002f24b3a5e5b70fa0050fd2f70286c3c6 100644 (file)
@@ -154,10 +154,11 @@ DSGraph &BUDataStructures::calculateGraph(Function &F) {
     }
   } while (Inlined && !FCs.empty());
 
+#if 0
   Graph->maskIncompleteMarkers();
   Graph->markIncompleteNodes();
-  Graph->removeTriviallyDeadNodes(false);
   Graph->removeDeadNodes(/*KeepAllGlobals*/ true, /*KeepCalls*/ true);
+#endif
 
   DEBUG(std::cerr << "  [BU] Done inlining: " << F.getName() << " ["
         << Graph->getGraphSize() << "+" << Graph->getFunctionCalls().size()
index 584031bade3325a2f9e281a378e11aa05d55fc3f..630ec5f4d34a3a92153e3a159021b1c0df7986cb 100644 (file)
@@ -772,8 +772,7 @@ static void removeRefsToGlobal(DSNode* N,
 //
 bool DSGraph::isNodeDead(DSNode *N) {
   // Is it a trivially dead shadow node...
-  if (N->getReferrers().empty() &&
-      (N->NodeType == 0 || N->NodeType == DSNode::DEAD))
+  if (N->getReferrers().empty() && (N->NodeType & ~DSNode::DEAD) == 0)
     return true;
 
   // Is it a function node or some other trivially unused global?
index e731d5cb7bbf13a37804d2601158e3ce517acf2d..3df4fd4f600ffd3854c7339d4164c9ed61512c70 100644 (file)
@@ -74,9 +74,6 @@ namespace {
           getValueDest(*I);
 
       visit(G.getFunction());  // Single pass over the function
-
-      // Not inlining, only eliminate trivially dead nodes.
-      G.removeTriviallyDeadNodes();
     }
 
   private:
@@ -135,6 +132,9 @@ DSGraph::DSGraph(Function &F, DSGraph *GG) : Func(&F), GlobalsGraph(GG) {
   // Use the graph builder to construct the local version of the graph
   GraphBuilder B(*this, Nodes, RetNode, ScalarMap, FunctionCalls);
   markIncompleteNodes();
+
+  // Remove any nodes made dead due to merging...
+  removeDeadNodes(true, true);
 }
 
 
index aad8657d1daf50a4f7fa415c05f6d800184b5239..5ee4dc4cecede3914350ca52c3d6fdc0f376a9b0 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->removeTriviallyDeadNodes();
+  ResultGraph->removeDeadNodes(true, true);
 
   DEBUG(print(std::cerr, &M));
   return false;
index 36d8aca78ca52a99ee9d010315c1a3d9b26aad2a..ee559d6fc0d4292f03568c5b4c0f9520ee4e8424 100644 (file)
@@ -180,7 +180,6 @@ void TDDataStructures::calculateGraph(Function &F) {
       CG.maskIncompleteMarkers();
       CG.markIncompleteNodes(/*markFormals*/ !F.hasInternalLinkage()
                              /*&& FIXME: NEED TO CHECK IF ALL CALLERS FOUND!*/);
-      CG.removeTriviallyDeadNodes(false);
       CG.removeDeadNodes(false, true) ;///*KeepAllGlobals*/ false, true);
       ///*KeepCalls*/ false);
     }