[SDAG] Add an assert that we don't mess up the number of values when
authorChandler Carruth <chandlerc@gmail.com>
Sat, 26 Jul 2014 05:53:16 +0000 (05:53 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Sat, 26 Jul 2014 05:53:16 +0000 (05:53 +0000)
replacing nodes in the legalizer.

This caught a number of bugs for me during development.

llvm-svn: 214022

llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

index 96e569e..0275990 100644 (file)
@@ -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));