diff options
author | Chris Lattner <sabre@nondot.org> | 2002-11-09 21:00:49 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-11-09 21:00:49 +0000 |
commit | 380d1ad4ab911221bca58ca1f32b0400f6635829 (patch) | |
tree | b81327daf6388860035309eb1631b397a6d5c9b3 /llvm/lib/Analysis/DataStructure/DataStructure.cpp | |
parent | e703c52b20f7ee1ad9cf9c0f22f5e5c64401a977 (diff) | |
download | bcm5719-llvm-380d1ad4ab911221bca58ca1f32b0400f6635829.tar.gz bcm5719-llvm-380d1ad4ab911221bca58ca1f32b0400f6635829.zip |
Clean up DSGraph::removeDeadNodes interface
llvm-svn: 4660
Diffstat (limited to 'llvm/lib/Analysis/DataStructure/DataStructure.cpp')
-rw-r--r-- | llvm/lib/Analysis/DataStructure/DataStructure.cpp | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/llvm/lib/Analysis/DataStructure/DataStructure.cpp b/llvm/lib/Analysis/DataStructure/DataStructure.cpp index 630ec5f4d34..f1fce0fb97d 100644 --- a/llvm/lib/Analysis/DataStructure/DataStructure.cpp +++ b/llvm/lib/Analysis/DataStructure/DataStructure.cpp @@ -981,10 +981,7 @@ 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, bool KeepCalls) { - assert((!KeepAllGlobals || KeepCalls) && // FIXME: This should be an enum! - "KeepAllGlobals without KeepCalls is meaningless"); - +void DSGraph::removeDeadNodes(bool KeepAllGlobals) { // Reduce the amount of work we have to do... removeTriviallyDeadNodes(KeepAllGlobals); @@ -994,19 +991,17 @@ void DSGraph::removeDeadNodes(bool KeepAllGlobals, bool KeepCalls) { std::set<DSNode*> Alive; // If KeepCalls, mark all nodes reachable by call nodes as alive... - if (KeepCalls) { - for (unsigned i = 0, e = FunctionCalls.size(); i != e; ++i) { - for (unsigned j = 0, e = FunctionCalls[i].getNumPtrArgs(); j != e; ++j) - markAlive(FunctionCalls[i].getPtrArg(j).getNode(), Alive); - markAlive(FunctionCalls[i].getRetVal().getNode(), Alive); - markAlive(FunctionCalls[i].getCallee().getNode(), Alive); - } - for (unsigned i = 0, e = AuxFunctionCalls.size(); i != e; ++i) { - for (unsigned j = 0, e = AuxFunctionCalls[i].getNumPtrArgs(); j != e; ++j) - markAlive(AuxFunctionCalls[i].getPtrArg(j).getNode(), Alive); - markAlive(AuxFunctionCalls[i].getRetVal().getNode(), Alive); - markAlive(AuxFunctionCalls[i].getCallee().getNode(), Alive); - } + for (unsigned i = 0, e = FunctionCalls.size(); i != e; ++i) { + for (unsigned j = 0, e = FunctionCalls[i].getNumPtrArgs(); j != e; ++j) + markAlive(FunctionCalls[i].getPtrArg(j).getNode(), Alive); + markAlive(FunctionCalls[i].getRetVal().getNode(), Alive); + markAlive(FunctionCalls[i].getCallee().getNode(), Alive); + } + for (unsigned i = 0, e = AuxFunctionCalls.size(); i != e; ++i) { + for (unsigned j = 0, e = AuxFunctionCalls[i].getNumPtrArgs(); j != e; ++j) + markAlive(AuxFunctionCalls[i].getPtrArg(j).getNode(), Alive); + markAlive(AuxFunctionCalls[i].getRetVal().getNode(), Alive); + markAlive(AuxFunctionCalls[i].getCallee().getNode(), Alive); } // Mark all nodes reachable by scalar nodes as alive... @@ -1022,7 +1017,7 @@ void DSGraph::removeDeadNodes(bool KeepAllGlobals, bool KeepCalls) { // Of course, if KeepAllGlobals is specified, they would be live already. if (!KeepAllGlobals) - markGlobalsAlive(*this, Alive, !KeepCalls); + markGlobalsAlive(*this, Alive, false); // Loop over all unreachable nodes, dropping their references... vector<DSNode*> DeadNodes; @@ -1157,7 +1152,7 @@ void GlobalDSGraph::cloneGlobals(DSGraph& Graph, bool CloneCalls) { if (CloneCalls) GlobalsGraph->cloneCalls(Graph); - GlobalsGraph->removeDeadNodes(/*KeepAllGlobals*/ true, /*KeepCalls*/ true); + GlobalsGraph->removeDeadNodes(/*KeepAllGlobals*/ true); #endif } |