* Rename UnlinkUndistinguishableShadowNodes & RemoveUnreachableShadowNodes
authorChris Lattner <sabre@nondot.org>
Thu, 28 Mar 2002 19:16:48 +0000 (19:16 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 28 Mar 2002 19:16:48 +0000 (19:16 +0000)
  to reflect that they can eliminate arbitrary nodes.
* Rename the ShadowNodeEliminate.cpp file to EliminateNodes.cpp for the
  same reason

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

lib/Analysis/DataStructure/ComputeClosure.cpp
lib/Analysis/DataStructure/EliminateNodes.cpp
lib/Analysis/DataStructure/FunctionRepBuilder.cpp

index 1f15b681abc269929ddb882fb959c35bbe5ccfc5..a86d6e50e32c371a050e0077e4f513bc0ae753f1 100644 (file)
@@ -193,10 +193,10 @@ void FunctionDSGraph::computeClosure(const DataStructure &DS) {
       // Eliminate shadow nodes that are not distinguishable from some other
       // node in the graph...
       //
-      Changed = UnlinkUndistinguishableShadowNodes();
+      Changed = UnlinkUndistinguishableNodes();
 
       // Eliminate shadow nodes that are now extraneous due to linking...
-      Changed |= RemoveUnreachableShadowNodes();
+      Changed |= RemoveUnreachableNodes();
     }
 
     //if (F == Func) return;  // Only do one self inlining
index 39fdd2c5b290a0d10422420b791f88e9a5161d8d..471c6281df9df1bb4dffe5e7245b16988cd765f0 100644 (file)
@@ -1,16 +1,17 @@
-//===- ShadowNodeEliminate.cpp - Optimize away shadow nodes ---------------===//
+//===- EliminateNodes.cpp - Prune unneccesary nodes in the graph ----------===//
 //
-// This file contains two shadow node optimizations:
-//   1. UnlinkUndistinguishableShadowNodes - Often, after unification, shadow
+// This file contains two node optimizations:
+//   1. UnlinkUndistinguishableNodes - Often, after unification, shadow
 //      nodes are left around that should not exist anymore.  An example is when
 //      a shadow gets unified with a 'new' node, the following graph gets
 //      generated:  %X -> Shadow, %X -> New.  Since all of the edges to the
 //      shadow node also all go to the New node, we can eliminate the shadow.
 //
-//   2. RemoveUnreachableShadowNodes - Remove shadow nodes that are not
-//      reachable from some other node in the graph.  Unreachable shadow nodes
-//      are left lying around because other transforms don't go to the trouble
-//      or removing them, since this pass exists.
+//   2. RemoveUnreachableNodes - Remove shadow and allocation nodes that are not
+//      reachable from some other node in the graph.  Unreachable nodes are left
+//      lying around often because a method only refers to some allocations with
+//      scalar values or an alloca, then when it is inlined, these references
+//      disappear and the nodes become homeless and prunable.
 //
 //===----------------------------------------------------------------------===//
 
@@ -57,7 +58,7 @@ bool ShadowDSNode::isEquivalentTo(DSNode *Node) const {
 // has exactly the same incoming links to it and if the node considers itself
 // to be the same as the other node...
 //
-bool isIndistinguishableNode(DSNode *DN) {
+static bool isIndistinguishableNode(DSNode *DN) {
   if (DN->getReferrers().empty()) {       // No referrers...
     if (isa<ShadowDSNode>(DN) || isa<AllocDSNode>(DN))
       return true;  // Node is trivially dead
@@ -127,10 +128,10 @@ bool removeIndistinguishableNode(std::vector<NodeTy*> &Nodes) {
   return Changed;
 }
 
-// UnlinkUndistinguishableShadowNodes - Eliminate shadow nodes that are not
+// UnlinkUndistinguishableNodes - Eliminate shadow nodes that are not
 // distinguishable from some other node in the graph...
 //
-bool FunctionDSGraph::UnlinkUndistinguishableShadowNodes() {
+bool FunctionDSGraph::UnlinkUndistinguishableNodes() {
   // Loop over all of the shadow nodes, checking to see if they are
   // indistinguishable from some other node.  If so, eliminate the node!
   //
@@ -192,7 +193,7 @@ static void MarkReferredNodesReachable(DSNode *N,
                                    AllocNodes, ReachableAllocNodes);
 }
 
-bool FunctionDSGraph::RemoveUnreachableShadowNodes() {
+bool FunctionDSGraph::RemoveUnreachableNodes() {
   bool Changed = false;
 
   while (1) {
index 87d4a332cedd2647f83a36e74ecc648bf976f013..60cf964042925792200323c72840eda396f86a2c 100644 (file)
@@ -339,10 +339,10 @@ FunctionDSGraph::FunctionDSGraph(Function *F) : Func(F) {
     // Eliminate shadow nodes that are not distinguishable from some other
     // node in the graph...
     //
-    Changed = UnlinkUndistinguishableShadowNodes();
+    Changed = UnlinkUndistinguishableNodes();
 
     // Eliminate shadow nodes that are now extraneous due to linking...
-    Changed |= RemoveUnreachableShadowNodes();
+    Changed |= RemoveUnreachableNodes();
   }
 }