summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-10-05 06:35:28 +0000
committerChris Lattner <sabre@nondot.org>2005-10-05 06:35:28 +0000
commit06f1d0f73abb7c91902006574a95d7758a8bb95a (patch)
tree3ad56537a004eb16d8d1af686e7d3ce02c59b713 /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
parent5fc3672722a98fc0f3c6040c47fa9d2e4251c91c (diff)
downloadbcm5719-llvm-06f1d0f73abb7c91902006574a95d7758a8bb95a.tar.gz
bcm5719-llvm-06f1d0f73abb7c91902006574a95d7758a8bb95a.zip
Add a new HandleNode class, which is used to handle (haha) cases in the
dead node elim and dag combiner passes where the root is potentially updated. This fixes a fixme in the dag combiner. llvm-svn: 23634
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 61fa31959c1..d861e15fcbc 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -176,7 +176,7 @@ void SelectionDAG::RemoveDeadNodes(SDNode *N) {
// Create a dummy node (which is not added to allnodes), that adds a reference
// to the root node, preventing it from being deleted.
- SDNode *DummyNode = new SDNode(ISD::EntryToken, getRoot());
+ HandleSDNode Dummy(getRoot());
// If we have a hint to start from, use it.
if (N) DeleteNodeIfDead(N, &AllNodeSet);
@@ -199,11 +199,7 @@ void SelectionDAG::RemoveDeadNodes(SDNode *N) {
AllNodes.assign(AllNodeSet.begin(), AllNodeSet.end());
// If the root changed (e.g. it was a dead load, update the root).
- setRoot(DummyNode->getOperand(0));
-
- // Now that we are done with the dummy node, delete it.
- DummyNode->getOperand(0).Val->removeUser(DummyNode);
- delete DummyNode;
+ setRoot(Dummy.getValue());
}
@@ -276,6 +272,7 @@ void SelectionDAG::DeleteNodeNotInCSEMaps(SDNode *N) {
void SelectionDAG::RemoveNodeFromCSEMaps(SDNode *N) {
bool Erased = false;
switch (N->getOpcode()) {
+ case ISD::HANDLENODE: return; // noop.
case ISD::Constant:
Erased = Constants.erase(std::make_pair(cast<ConstantSDNode>(N)->getValue(),
N->getValueType(0)));
@@ -397,6 +394,8 @@ SDNode *SelectionDAG::AddNonLeafNodeToCSEMaps(SDNode *N) {
N->getValueType(0)))];
if (L) return L;
L = N;
+ } else if (N->getOpcode() == ISD::HANDLENODE) {
+ return 0; // never add it.
} else if (N->getNumOperands() == 1) {
SDNode *&U = UnaryOps[std::make_pair(N->getOpcode(),
std::make_pair(N->getOperand(0),
OpenPOWER on IntegriCloud