summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2017-10-19 20:59:41 +0000
committerCraig Topper <craig.topper@intel.com>2017-10-19 20:59:41 +0000
commitff69ffbf9a60edcda76f7420973c1eedb3e873b1 (patch)
tree3bb8ebf3b406da9f3db4eef0d3e99faf89aa3362 /llvm/lib
parent7bce79a539b9445a7957b4c96e0cd88cbd231a18 (diff)
downloadbcm5719-llvm-ff69ffbf9a60edcda76f7420973c1eedb3e873b1.tar.gz
bcm5719-llvm-ff69ffbf9a60edcda76f7420973c1eedb3e873b1.zip
[SelectionDAG] Add a check to getVectorShuffle to ensure that the only negative index we allow is -1.
llvm-svn: 316183
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 0d999984cdb..4b0a5e07238 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -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.
OpenPOWER on IntegriCloud