[SelectionDAG] Add a check to getVectorShuffle to ensure that the only negative index we allow is -1.

llvm-svn: 316183
This commit is contained in:
Craig Topper 2017-10-19 20:59:41 +00:00
parent 7bce79a539
commit ff69ffbf9a

View File

@ -1486,7 +1486,8 @@ SDValue SelectionDAG::getVectorShuffle(EVT VT, const SDLoc &dl, SDValue N1,
// Validate that all indices in Mask are within the range of the elements
// input to the shuffle.
int NElts = Mask.size();
assert(llvm::all_of(Mask, [&](int M) { return M < (NElts * 2); }) &&
assert(llvm::all_of(Mask,
[&](int M) { return M < (NElts * 2) && M >= -1; }) &&
"Index out of range");
// Copy the mask so we can do any needed cleanup.