[llvm] r214022 - [SDAG] Add an assert that we don't mess up the number of values when

Chandler Carruth chandlerc at gmail.com
Fri Jul 25 22:53:17 PDT 2014


Author: chandlerc
Date: Sat Jul 26 00:53:16 2014
New Revision: 214022

URL: http://llvm.org/viewvc/llvm-project?rev=214022&view=rev
Log:
[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.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=214022&r1=214021&r2=214022&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Sat Jul 26 00:53:16 2014
@@ -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));





More information about the llvm-commits mailing list