Added check to avoid generating extract subvector beyond the end of the vector when...
authorMon P Wang <wangmp@apple.com>
Sun, 23 Nov 2008 04:35:05 +0000 (04:35 +0000)
committerMon P Wang <wangmp@apple.com>
Sun, 23 Nov 2008 04:35:05 +0000 (04:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59900 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp

index 94170420d0f1880a284ed36c05598ab7ad6db7fa..f3948f9ee8ac1c06d8242e11c3157afc639c85e8 100644 (file)
@@ -2423,7 +2423,8 @@ void SelectionDAGLowering::visitShuffleVector(User &I) {
           StartIdx[Input] = 0;
         } else {
           StartIdx[Input] = (MinRange[Input]/MaskNumElts)*MaskNumElts;
-          if (MaxRange[Input] - StartIdx[Input] < MaskNumElts) 
+          if (MaxRange[Input] - StartIdx[Input] < MaskNumElts &&
+              StartIdx[Input] + MaskNumElts < SrcNumElts) 
             RangeUse[Input] = 1; // Extract from a multiple of the mask length.
         }
       }