mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-01 00:33:09 +00:00
Allow merging of identical call nodes. Make the shadow node pointed to
by the call node noncritical before the call is destroyed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2082 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bab4a90cb9
commit
f30185fdfb
@ -53,6 +53,23 @@ static void DestroyFirstNodeOfPair(DSNode *N1, DSNode *N2) {
|
|||||||
assert(RanOnce && "Node on user set but cannot find the use!");
|
assert(RanOnce && "Node on user set but cannot find the use!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we are about to eliminate a call node that returns a pointer, make the
|
||||||
|
// shadow node it points to not be critical anymore!
|
||||||
|
//
|
||||||
|
if (isa<CallDSNode>(N1) && N1->getNumLinks()) {
|
||||||
|
assert(N1->getNumLinks() == 1 && "Call node can only return one pointer!");
|
||||||
|
PointerValSet &PVS = N1->getLink(0);
|
||||||
|
|
||||||
|
for (unsigned i = 0, e = PVS.size(); i != e; ++i)
|
||||||
|
if (ShadowDSNode *Shad = dyn_cast<ShadowDSNode>(PVS[i].Node))
|
||||||
|
if (Shad->isCriticalNode()) {
|
||||||
|
Shad->resetCriticalMark(); // Only unmark _ONE_ node..
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
N1->removeAllIncomingEdges();
|
N1->removeAllIncomingEdges();
|
||||||
delete N1;
|
delete N1;
|
||||||
}
|
}
|
||||||
@ -170,10 +187,7 @@ bool FunctionDSGraph::UnlinkUndistinguishableNodes() {
|
|||||||
return
|
return
|
||||||
removeIndistinguishableNodes(AllocNodes) |
|
removeIndistinguishableNodes(AllocNodes) |
|
||||||
removeIndistinguishableNodes(ShadowNodes) |
|
removeIndistinguishableNodes(ShadowNodes) |
|
||||||
//FIXME: We cannot naively remove call nodes here because if there is a
|
removeIndistinguishableNodePairs(CallNodes) |
|
||||||
// shadow node that is the result of the call, we have to make sure to
|
|
||||||
// merge the shadow node as well!!!
|
|
||||||
// removeIndistinguishableNodePairs(CallNodes) |
|
|
||||||
removeIndistinguishableNodePairs(GlobalNodes);
|
removeIndistinguishableNodePairs(GlobalNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user