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

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 19 13:59:41 PDT 2017


Author: ctopper
Date: Thu Oct 19 13:59:41 2017
New Revision: 316183

URL: http://llvm.org/viewvc/llvm-project?rev=316183&view=rev
Log:
[SelectionDAG] Add a check to getVectorShuffle to ensure that the only negative index we allow is -1.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=316183&r1=316182&r2=316183&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Oct 19 13:59:41 2017
@@ -1486,7 +1486,8 @@ SDValue SelectionDAG::getVectorShuffle(E
   // 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.




More information about the llvm-commits mailing list