aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--utils/TableGen/DAGISelEmitter.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp
index 277d41e985..34bcd360bf 100644
--- a/utils/TableGen/DAGISelEmitter.cpp
+++ b/utils/TableGen/DAGISelEmitter.cpp
@@ -121,6 +121,13 @@ TreePatternNode *SDTypeConstraint::getOperandNum(unsigned OpNo,
assert(NumResults <= 1 &&
"We only work with nodes with zero or one result so far!");
+ if (OpNo >= (NumResults + N->getNumChildren())) {
+ std::cerr << "Invalid operand number " << OpNo << " ";
+ N->dump();
+ std::cerr << '\n';
+ exit(1);
+ }
+
if (OpNo < NumResults)
return N; // FIXME: need value #
else