diff options
author | Chris Lattner <sabre@nondot.org> | 2002-04-01 00:13:56 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-04-01 00:13:56 +0000 |
commit | 6b06aa557ecab869674336f654d47437ac46d87e (patch) | |
tree | aa8728a397541cfb3a5dfda2459b8390d1c2e74c /llvm/lib/Analysis/DataStructure/EliminateNodes.cpp | |
parent | a7b3b50381cf267927163912ee8a946fdf7c5ef9 (diff) | |
download | bcm5719-llvm-6b06aa557ecab869674336f654d47437ac46d87e.tar.gz bcm5719-llvm-6b06aa557ecab869674336f654d47437ac46d87e.zip |
Allow merging of identical call nodes. Make the shadow node pointed to
by the call node noncritical before the call is destroyed.
llvm-svn: 2082
Diffstat (limited to 'llvm/lib/Analysis/DataStructure/EliminateNodes.cpp')
-rw-r--r-- | llvm/lib/Analysis/DataStructure/EliminateNodes.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/DataStructure/EliminateNodes.cpp b/llvm/lib/Analysis/DataStructure/EliminateNodes.cpp index 7dd5b3317b0..767f7fe006d 100644 --- a/llvm/lib/Analysis/DataStructure/EliminateNodes.cpp +++ b/llvm/lib/Analysis/DataStructure/EliminateNodes.cpp @@ -53,6 +53,23 @@ static void DestroyFirstNodeOfPair(DSNode *N1, DSNode *N2) { 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(); delete N1; } @@ -170,10 +187,7 @@ bool FunctionDSGraph::UnlinkUndistinguishableNodes() { return removeIndistinguishableNodes(AllocNodes) | removeIndistinguishableNodes(ShadowNodes) | - //FIXME: We cannot naively remove call nodes here because if there is a - // shadow node that is the result of the call, we have to make sure to - // merge the shadow node as well!!! - // removeIndistinguishableNodePairs(CallNodes) | + removeIndistinguishableNodePairs(CallNodes) | removeIndistinguishableNodePairs(GlobalNodes); } |