[SelectionDAG] Add an assert in getNode() for EXTRACT_VECTOR_ELT.

When getNode() is called to create an EXTRACT_VECTOR_ELT, assert that
the result VT is at least as wide as the vector element type.

Review: Eli Friedman
llvm-svn: 324061
This commit is contained in:
Jonas Paulsson 2018-02-02 08:21:53 +00:00
parent 0e50b6ed80
commit ad089fe46e
1 changed files with 4 additions and 0 deletions

View File

@ -4450,6 +4450,10 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
break;
}
case ISD::EXTRACT_VECTOR_ELT:
assert(VT.getSizeInBits() >= N1.getValueType().getScalarSizeInBits() &&
"The result of EXTRACT_VECTOR_ELT must be at least as wide as the \
element type of the vector.");
// EXTRACT_VECTOR_ELT of an UNDEF is an UNDEF.
if (N1.isUndef())
return getUNDEF(VT);