diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index 3ab273c9c24..623ba20ecef 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -4684,10 +4684,10 @@ static SDValue getOnesVector(EVT VT, const X86Subtarget &Subtarget, static SDValue getUnpackl(SelectionDAG &DAG, const SDLoc &dl, MVT VT, SDValue V1, SDValue V2) { unsigned NumElems = VT.getVectorNumElements(); - SmallVector Mask; + SmallVector Mask(NumElems); for (unsigned i = 0, e = NumElems/2; i != e; ++i) { - Mask.push_back(i); - Mask.push_back(i + NumElems); + Mask[i * 2] = i; + Mask[i * 2 + 1] = i + NumElems; } return DAG.getVectorShuffle(VT, dl, V1, V2, &Mask[0]); } @@ -4696,10 +4696,10 @@ static SDValue getUnpackl(SelectionDAG &DAG, const SDLoc &dl, MVT VT, static SDValue getUnpackh(SelectionDAG &DAG, const SDLoc &dl, MVT VT, SDValue V1, SDValue V2) { unsigned NumElems = VT.getVectorNumElements(); - SmallVector Mask; + SmallVector Mask(NumElems); for (unsigned i = 0, Half = NumElems/2; i != Half; ++i) { - Mask.push_back(i + Half); - Mask.push_back(i + NumElems + Half); + Mask[i * 2] = i + Half; + Mask[i * 2 + 1] = i + NumElems + Half; } return DAG.getVectorShuffle(VT, dl, V1, V2, &Mask[0]); } @@ -4708,18 +4708,18 @@ static SDValue getUnpackh(SelectionDAG &DAG, const SDLoc &dl, MVT VT, /// This produces a shuffle where the low element of V2 is swizzled into the /// zero/undef vector, landing at element Idx. /// This produces a shuffle mask like 4,1,2,3 (idx=0) or 0,1,2,4 (idx=3). -static SDValue getShuffleVectorZeroOrUndef(SDValue V2, unsigned Idx, +static SDValue getShuffleVectorZeroOrUndef(SDValue V2, int Idx, bool IsZero, const X86Subtarget &Subtarget, SelectionDAG &DAG) { MVT VT = V2.getSimpleValueType(); SDValue V1 = IsZero ? getZeroVector(VT, Subtarget, DAG, SDLoc(V2)) : DAG.getUNDEF(VT); - unsigned NumElems = VT.getVectorNumElements(); - SmallVector MaskVec; - for (unsigned i = 0; i != NumElems; ++i) + int NumElems = VT.getVectorNumElements(); + SmallVector MaskVec(NumElems); + for (int i = 0; i != NumElems; ++i) // If this is the insertion idx, put the low elt of V2 here. - MaskVec.push_back(i == Idx ? NumElems : i); + MaskVec[i] = (i == Idx) ? NumElems : i; return DAG.getVectorShuffle(VT, SDLoc(V2), V1, V2, &MaskVec[0]); } @@ -10955,7 +10955,7 @@ static SDValue lowerShuffleAsRepeatedMaskAndLanePermute( } // Bail if we already have a repeated lane shuffle mask. - SmallVector RepeatedShuffleMask((unsigned)NumLaneElts, -1); + SmallVector RepeatedShuffleMask; if (is128BitLaneRepeatedShuffleMask(VT, Mask, RepeatedShuffleMask)) return SDValue();