diff options
author | Craig Topper <craig.topper@intel.com> | 2017-10-19 20:59:41 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@intel.com> | 2017-10-19 20:59:41 +0000 |
commit | fb5a67b59440cfd44ae8c3bb6d64612ff4500090 (patch) | |
tree | fa38e5854e1e3c26174fabb188e359691962271e | |
parent | 096ea8c9fd09c6258492b111e58f0732b785fe22 (diff) |
[SelectionDAG] Add a check to getVectorShuffle to ensure that the only negative index we allow is -1.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316183 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 0d999984cdb..4b0a5e07238 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/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. |