Prune function nodes that are no longer referenced due to inlining
authorChris Lattner <sabre@nondot.org>
Thu, 3 Oct 2002 21:55:28 +0000 (21:55 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 3 Oct 2002 21:55:28 +0000 (21:55 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4036 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/DataStructure/BottomUpClosure.cpp
lib/Analysis/DataStructure/DataStructure.cpp

index 11ee6065d190b4e2a4e1cb5206ad57f9f1372579..475f6878d58a5bf21ea17d559040b19ad1a52dfe 100644 (file)
@@ -253,6 +253,7 @@ DSGraph &BUDataStructures::calculateGraph(Function &F) {
 
   Graph->maskIncompleteMarkers();
   Graph->markIncompleteNodes();
+  Graph->removeTriviallyDeadNodes(false);
   Graph->removeDeadNodes(/*KeepAllGlobals*/ true, /*KeepCalls*/ true);
 
   DEBUG(std::cerr << "  [BU] Done inlining: " << F.getName() << " ["
index f50c8ea6cfb793e75c09fce0c6393cd9a05c8445..0c4362b3756f321e3d7252ad50dd60a26a18f419 100644 (file)
@@ -578,7 +578,7 @@ bool DSGraph::isNodeDead(DSNode *N) {
       N->getSize() == 0 &&
       N->getReferrers().size() == N->getGlobals().size()) {
 
-    // Remove the globals from the valuemap, so that the referrer count will go
+    // Remove the globals from the ValueMap, so that the referrer count will go
     // down to zero.
     removeRefsToGlobal(N, ValueMap);
     assert(N->getReferrers().empty() && "Referrers should all be gone now!");
@@ -608,7 +608,7 @@ static void removeIdenticalCalls(vector<vector<DSNodeHandle> > &Calls,
 //
 void DSGraph::removeTriviallyDeadNodes(bool KeepAllGlobals) {
   for (unsigned i = 0; i != Nodes.size(); ++i)
-    if (! KeepAllGlobals || ! (Nodes[i]->NodeType & DSNode::GlobalNode))
+    if (!KeepAllGlobals || !(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...