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
This commit is contained in:
Devang Patel 2011-01-27 17:43:53 +00:00
parent 54b0f4f2a4
commit bfae5f312c
2 changed files with 4 additions and 1 deletions

View File

@ -87,6 +87,9 @@ class SelectionDAGLegalize {
// If someone requests legalization of the new node, return itself. // If someone requests legalization of the new node, return itself.
if (From != To) if (From != To)
LegalizedNodes.insert(std::make_pair(To, To)); LegalizedNodes.insert(std::make_pair(To, To));
// Transfer SDDbgValues.
DAG.TransferDbgValues(From, To);
} }
public: public:

View File

@ -5474,7 +5474,6 @@ void SelectionDAG::TransferDbgValues(SDValue From, SDValue To) {
SDNode *FromNode = From.getNode(); SDNode *FromNode = From.getNode();
SDNode *ToNode = To.getNode(); SDNode *ToNode = To.getNode();
SmallVector<SDDbgValue*,2> &DVs = GetDbgValues(FromNode); SmallVector<SDDbgValue*,2> &DVs = GetDbgValues(FromNode);
DbgInfo->removeSDDbgValues(FromNode);
for (SmallVector<SDDbgValue *, 2>::iterator I = DVs.begin(), E = DVs.end(); for (SmallVector<SDDbgValue *, 2>::iterator I = DVs.begin(), E = DVs.end();
I != E; ++I) { I != E; ++I) {
if ((*I)->getKind() == SDDbgValue::SDNODE) { if ((*I)->getKind() == SDDbgValue::SDNODE) {
@ -5482,6 +5481,7 @@ void SelectionDAG::TransferDbgValues(SDValue From, SDValue To) {
(*I)->setSDNode(ToNode, To.getResNo()); (*I)->setSDNode(ToNode, To.getResNo());
} }
} }
DbgInfo->removeSDDbgValues(FromNode);
} }
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//