From bfae5f312c5a726687b4f2201681fb5519568e14 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Thu, 27 Jan 2011 17:43:53 +0000 Subject: [PATCH] While legalizing SDValues do not drop SDDbgValues, trasfer them to new legal nodes. Take 2. This includes fix for dragonegg crash. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124380 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 3 +++ lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index 9c35b40012b..f588dd06668 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -87,6 +87,9 @@ class SelectionDAGLegalize { // If someone requests legalization of the new node, return itself. if (From != To) LegalizedNodes.insert(std::make_pair(To, To)); + + // Transfer SDDbgValues. + DAG.TransferDbgValues(From, To); } public: diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index d14cae39192..17be6b14b77 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -5474,7 +5474,6 @@ void SelectionDAG::TransferDbgValues(SDValue From, SDValue To) { SDNode *FromNode = From.getNode(); SDNode *ToNode = To.getNode(); SmallVector &DVs = GetDbgValues(FromNode); - DbgInfo->removeSDDbgValues(FromNode); for (SmallVector::iterator I = DVs.begin(), E = DVs.end(); I != E; ++I) { if ((*I)->getKind() == SDDbgValue::SDNODE) { @@ -5482,6 +5481,7 @@ void SelectionDAG::TransferDbgValues(SDValue From, SDValue To) { (*I)->setSDNode(ToNode, To.getResNo()); } } + DbgInfo->removeSDDbgValues(FromNode); } //===----------------------------------------------------------------------===//