From 6cce3dae900152203a51299e928d8ec738537d6a Mon Sep 17 00:00:00 2001 From: Mon P Wang Date: Sun, 23 Nov 2008 04:35:05 +0000 Subject: [PATCH] Added check to avoid generating extract subvector beyond the end of the vector when normalizing vector shuffles. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59900 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp index 94170420d0f..f3948f9ee8a 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp @@ -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. } }