From: Chris Lattner Date: Sun, 28 Mar 2010 05:28:31 +0000 (+0000) Subject: don't add nodes to the now-dead nodes list multiple times, this X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=856fb395e46a8d485081acbf11928047d852c636;p=oota-llvm.git don't add nodes to the now-dead nodes list multiple times, this can cause a crash on crazy situations in msp430 when morph-node-to is disabled. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99739 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 600557eddfd..3981826f59a 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -1592,8 +1592,9 @@ UpdateChainsAndFlags(SDNode *NodeToMatch, SDValue InputChain, assert(ChainVal.getValueType() == MVT::Other && "Not a chain?"); CurDAG->ReplaceAllUsesOfValueWith(ChainVal, InputChain, &ISU); - // If the node became dead, delete it. - if (ChainNode->use_empty()) + // If the node became dead and we haven't already seen it, delete it. + if (ChainNode->use_empty() && + !std::count(NowDeadNodes.begin(), NowDeadNodes.end(), ChainNode)) NowDeadNodes.push_back(ChainNode); } }