From eeecc3e1b3845a7ca57053ea5f346189696e0aef Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 3 Oct 2002 21:55:28 +0000 Subject: [PATCH] Prune function nodes that are no longer referenced due to inlining llvm-svn: 4036 --- lib/Analysis/DataStructure/BottomUpClosure.cpp | 1 + lib/Analysis/DataStructure/DataStructure.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Analysis/DataStructure/BottomUpClosure.cpp b/lib/Analysis/DataStructure/BottomUpClosure.cpp index 11ee6065d19..475f6878d58 100644 --- a/lib/Analysis/DataStructure/BottomUpClosure.cpp +++ b/lib/Analysis/DataStructure/BottomUpClosure.cpp @@ -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() << " [" diff --git a/lib/Analysis/DataStructure/DataStructure.cpp b/lib/Analysis/DataStructure/DataStructure.cpp index f50c8ea6cfb..0c4362b3756 100644 --- a/lib/Analysis/DataStructure/DataStructure.cpp +++ b/lib/Analysis/DataStructure/DataStructure.cpp @@ -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 > &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...