mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-07-18 12:29:27 +00:00
Fix a problem Nate and Duraid reported where simplifying nodes can cause
them to get ressurected, in which case, deleting the undead nodes is unfriendly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26291 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
dca7abed91
commit
7d20d39009
@ -120,18 +120,22 @@ namespace {
|
|||||||
std::vector<SDNode*> NowDead;
|
std::vector<SDNode*> NowDead;
|
||||||
DAG.ReplaceAllUsesOfValueWith(TLO.Old, TLO.New, NowDead);
|
DAG.ReplaceAllUsesOfValueWith(TLO.Old, TLO.New, NowDead);
|
||||||
|
|
||||||
// Push the new node and any (now) users onto the worklist.
|
// Push the new node and any (possibly new) users onto the worklist.
|
||||||
WorkList.push_back(TLO.New.Val);
|
WorkList.push_back(TLO.New.Val);
|
||||||
AddUsersToWorkList(TLO.New.Val);
|
AddUsersToWorkList(TLO.New.Val);
|
||||||
|
|
||||||
// Nodes can end up on the worklist more than once. Make sure we do
|
// Nodes can end up on the worklist more than once. Make sure we do
|
||||||
// not process a node that has been replaced.
|
// not process a node that has been replaced.
|
||||||
removeFromWorkList(TLO.Old.Val);
|
|
||||||
for (unsigned i = 0, e = NowDead.size(); i != e; ++i)
|
for (unsigned i = 0, e = NowDead.size(); i != e; ++i)
|
||||||
removeFromWorkList(NowDead[i]);
|
removeFromWorkList(NowDead[i]);
|
||||||
|
|
||||||
// Finally, since the node is now dead, remove it from the graph.
|
// Finally, if the node is now dead, remove it from the graph. The node
|
||||||
|
// may not be dead if the replacement process recursively simplified to
|
||||||
|
// something else needing this node.
|
||||||
|
if (TLO.Old.Val->use_empty()) {
|
||||||
|
removeFromWorkList(TLO.Old.Val);
|
||||||
DAG.DeleteNode(TLO.Old.Val);
|
DAG.DeleteNode(TLO.Old.Val);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user