summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2011-11-08 01:25:24 +0000
committerEli Friedman <eli.friedman@gmail.com>2011-11-08 01:25:24 +0000
commitf2a9bd4b1ec21ed04fdac9b7120582eb6f800486 (patch)
treef2042feb729c950f0cf78f106718657a89abf320 /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
parent98bc98caa82734303dd1f4d0aee60917a4eba4bf (diff)
downloadbcm5719-llvm-f2a9bd4b1ec21ed04fdac9b7120582eb6f800486.tar.gz
bcm5719-llvm-f2a9bd4b1ec21ed04fdac9b7120582eb6f800486.zip
Add a bunch of calls to RemoveDeadNode in LegalizeDAG, so legalization doesn't get confused by CSE later on. Fixes PR11318.
Re-commit of r144034, with an extra fix so that RemoveDeadNode doesn't blow up. llvm-svn: 144055
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 010a740dc7c..b3f94a49451 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -564,6 +564,12 @@ void SelectionDAG::RemoveDeadNodes(SmallVectorImpl<SDNode *> &DeadNodes,
void SelectionDAG::RemoveDeadNode(SDNode *N, DAGUpdateListener *UpdateListener){
SmallVector<SDNode*, 16> DeadNodes(1, N);
+
+ // Create a dummy node that adds a reference to the root node, preventing
+ // it from being deleted. (This matters if the root is an operand of the
+ // dead node.)
+ HandleSDNode Dummy(getRoot());
+
RemoveDeadNodes(DeadNodes, UpdateListener);
}
OpenPOWER on IntegriCloud