Skip to content

Commit

Permalink
[SelectionDAG] Add an assert in getNode() for EXTRACT_VECTOR_ELT.
Browse files Browse the repository at this point in the history
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324061 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
JonPsson committed Feb 2, 2018
1 parent 04dc2a8 commit 5c0a276
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5c0a276

Please sign in to comment.