mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-17 00:57:54 +00:00
Prune function nodes that are no longer referenced due to inlining
llvm-svn: 4036
This commit is contained in:
parent
8f603615d8
commit
eeecc3e1b3
@ -253,6 +253,7 @@ DSGraph &BUDataStructures::calculateGraph(Function &F) {
|
|||||||
|
|
||||||
Graph->maskIncompleteMarkers();
|
Graph->maskIncompleteMarkers();
|
||||||
Graph->markIncompleteNodes();
|
Graph->markIncompleteNodes();
|
||||||
|
Graph->removeTriviallyDeadNodes(false);
|
||||||
Graph->removeDeadNodes(/*KeepAllGlobals*/ true, /*KeepCalls*/ true);
|
Graph->removeDeadNodes(/*KeepAllGlobals*/ true, /*KeepCalls*/ true);
|
||||||
|
|
||||||
DEBUG(std::cerr << " [BU] Done inlining: " << F.getName() << " ["
|
DEBUG(std::cerr << " [BU] Done inlining: " << F.getName() << " ["
|
||||||
|
@ -578,7 +578,7 @@ bool DSGraph::isNodeDead(DSNode *N) {
|
|||||||
N->getSize() == 0 &&
|
N->getSize() == 0 &&
|
||||||
N->getReferrers().size() == N->getGlobals().size()) {
|
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.
|
// down to zero.
|
||||||
removeRefsToGlobal(N, ValueMap);
|
removeRefsToGlobal(N, ValueMap);
|
||||||
assert(N->getReferrers().empty() && "Referrers should all be gone now!");
|
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) {
|
void DSGraph::removeTriviallyDeadNodes(bool KeepAllGlobals) {
|
||||||
for (unsigned i = 0; i != Nodes.size(); ++i)
|
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!
|
if (isNodeDead(Nodes[i])) { // This node is dead!
|
||||||
delete Nodes[i]; // Free memory...
|
delete Nodes[i]; // Free memory...
|
||||||
Nodes.erase(Nodes.begin()+i--); // Remove from node list...
|
Nodes.erase(Nodes.begin()+i--); // Remove from node list...
|
||||||
|
Loading…
x
Reference in New Issue
Block a user