From f1ce818befba97923e0a141adbd0691ddb7c55b7 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Sat, 26 Jul 2014 05:53:16 +0000 Subject: [PATCH] [SDAG] Add an assert that we don't mess up the number of values when replacing nodes in the legalizer. This caught a number of bugs for me during development. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214022 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index 96e569e7b64..0275990dcdf 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -180,6 +180,9 @@ public: } } void ReplaceNode(SDNode *Old, SDNode *New) { + assert(Old->getNumValues() == New->getNumValues() && + "Replacing one node with another that produces a different number " + "of values!"); DAG.ReplaceAllUsesWith(Old, New); for (unsigned i = 0, e = Old->getNumValues(); i != e; ++i) DAG.TransferDbgValues(SDValue(Old, i), SDValue(New, i));