diff options
author | David Majnemer <david.majnemer@gmail.com> | 2014-11-07 22:39:11 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2014-11-07 22:39:11 +0000 |
commit | c15788a23a3695e32b590644f78ab3d6931a12a5 (patch) | |
tree | bd88858460787a0216b8c43fb1838631f9606cb9 | |
parent | 5a1558ec31903371b0843382ce313749be0d13a4 (diff) | |
download | bcm5719-llvm-c15788a23a3695e32b590644f78ab3d6931a12a5.tar.gz bcm5719-llvm-c15788a23a3695e32b590644f78ab3d6931a12a5.zip |
SelectionDAG: Assert if we truncate SDNode's NumOperands or NumValues
No functionality change intended, this just stops us early if we created
a bad SDNode.
llvm-svn: 221560
-rw-r--r-- | llvm/include/llvm/CodeGen/SelectionDAGNodes.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h index 9e1f42763be..47158272412 100644 --- a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h +++ b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h @@ -762,6 +762,10 @@ protected: ValueList(VTs.VTs), UseList(nullptr), NumOperands(Ops.size()), NumValues(VTs.NumVTs), debugLoc(dl), IROrder(Order) { + assert(NumOperands == Ops.size() && + "NumOperands wasn't wide enough for its operands!"); + assert(NumValues == VTs.NumVTs && + "NumValues wasn't wide enough for its operands!"); for (unsigned i = 0; i != Ops.size(); ++i) { OperandList[i].setUser(this); OperandList[i].setInitial(Ops[i]); @@ -775,7 +779,10 @@ protected: : NodeType(Opc), OperandsNeedDelete(false), HasDebugValue(false), SubclassData(0), NodeId(-1), OperandList(nullptr), ValueList(VTs.VTs), UseList(nullptr), NumOperands(0), NumValues(VTs.NumVTs), debugLoc(dl), - IROrder(Order) {} + IROrder(Order) { + assert(NumValues == VTs.NumVTs && + "NumValues wasn't wide enough for its operands!"); + } /// InitOperands - Initialize the operands list of this with 1 operand. void InitOperands(SDUse *Ops, const SDValue &Op0) { @@ -834,6 +841,8 @@ protected: Ops[i].setInitial(Vals[i]); } NumOperands = N; + assert(NumOperands == N && + "NumOperands wasn't wide enough for its operands!"); OperandList = Ops; checkForCycles(this); } |