diff --git a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp --- a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp +++ b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp @@ -982,11 +982,10 @@ BaseTp->getElementType()->getPrimitiveSizeInBits()) { assert(NumElts >= NumSubElts && NumElts > OrigSubElts && "Unexpected number of elements!"); - VectorType *VecTy = VectorType::get(BaseTp->getElementType(), - LT.second.getVectorNumElements()); - VectorType *SubTy = - VectorType::get(BaseTp->getElementType(), - SubLT.second.getVectorNumElements()); + auto *VecTy = FixedVectorType::get(BaseTp->getElementType(), + LT.second.getVectorNumElements()); + auto *SubTy = FixedVectorType::get(BaseTp->getElementType(), + SubLT.second.getVectorNumElements()); int ExtractIndex = alignDown((Index % NumElts), NumSubElts); int ExtractCost = getShuffleCost(TTI::SK_ExtractSubvector, VecTy, ExtractIndex, SubTy); @@ -1057,9 +1056,8 @@ // Number of destination vectors after legalization: unsigned NumOfDests = LT.first; - VectorType *SingleOpTy = - VectorType::get(BaseTp->getElementType(), - LegalVT.getVectorNumElements()); + auto *SingleOpTy = FixedVectorType::get(BaseTp->getElementType(), + LegalVT.getVectorNumElements()); unsigned NumOfShuffles = (NumOfSrcs - 1) * NumOfDests; return NumOfShuffles * @@ -2894,7 +2892,7 @@ auto *SubTy = cast(Val); EVT VT = TLI->getValueType(DL, Val); if (VT.getScalarType() != MScalarTy || VT.getSizeInBits() >= 128) - SubTy = VectorType::get(ScalarType, SubNumElts); + SubTy = FixedVectorType::get(ScalarType, SubNumElts); ShuffleCost = getShuffleCost(TTI::SK_PermuteTwoSrc, SubTy, 0, SubTy); } int IntOrFpCost = ScalarType->isFloatingPointTy() ? 0 : 1; @@ -3046,8 +3044,8 @@ CostKind); unsigned NumElem = SrcVTy->getNumElements(); - VectorType *MaskTy = - VectorType::get(Type::getInt8Ty(SrcVTy->getContext()), NumElem); + auto *MaskTy = + FixedVectorType::get(Type::getInt8Ty(SrcVTy->getContext()), NumElem); if ((IsLoad && !isLegalMaskedLoad(SrcVTy, MaybeAlign(Alignment))) || (IsStore && !isLegalMaskedStore(SrcVTy, MaybeAlign(Alignment))) || !isPowerOf2_32(NumElem)) { @@ -3080,8 +3078,8 @@ getShuffleCost(TTI::SK_PermuteTwoSrc, MaskTy, 0, nullptr); else if (LT.second.getVectorNumElements() > NumElem) { - VectorType *NewMaskTy = VectorType::get(MaskTy->getElementType(), - LT.second.getVectorNumElements()); + auto *NewMaskTy = FixedVectorType::get(MaskTy->getElementType(), + LT.second.getVectorNumElements()); // Expanding requires fill mask with zeroes Cost += getShuffleCost(TTI::SK_InsertSubvector, NewMaskTy, 0, MaskTy); } @@ -3300,7 +3298,8 @@ if (LT.first != 1 && MTy.isVector() && MTy.getVectorNumElements() < ValVTy->getNumElements()) { // Type needs to be split. We need LT.first - 1 arithmetic ops. - Ty = VectorType::get(ValVTy->getElementType(), MTy.getVectorNumElements()); + Ty = FixedVectorType::get(ValVTy->getElementType(), + MTy.getVectorNumElements()); ReductionCost = getArithmeticInstrCost(Opcode, Ty, CostKind); ReductionCost *= LT.first - 1; NumVecElts = MTy.getVectorNumElements(); @@ -3314,26 +3313,30 @@ NumVecElts /= 2; // If we're reducing from 256/512 bits, use an extract_subvector. if (Size > 128) { - auto *SubTy = VectorType::get(ValVTy->getElementType(), NumVecElts); + auto *SubTy = FixedVectorType::get(ValVTy->getElementType(), NumVecElts); ReductionCost += getShuffleCost(TTI::SK_ExtractSubvector, Ty, NumVecElts, SubTy); Ty = SubTy; } else if (Size == 128) { // Reducing from 128 bits is a permute of v2f64/v2i64. - VectorType *ShufTy; + FixedVectorType *ShufTy; if (ValVTy->isFloatingPointTy()) - ShufTy = VectorType::get(Type::getDoubleTy(ValVTy->getContext()), 2); + ShufTy = + FixedVectorType::get(Type::getDoubleTy(ValVTy->getContext()), 2); else - ShufTy = VectorType::get(Type::getInt64Ty(ValVTy->getContext()), 2); + ShufTy = + FixedVectorType::get(Type::getInt64Ty(ValVTy->getContext()), 2); ReductionCost += getShuffleCost(TTI::SK_PermuteSingleSrc, ShufTy, 0, nullptr); } else if (Size == 64) { // Reducing from 64 bits is a shuffle of v4f32/v4i32. - VectorType *ShufTy; + FixedVectorType *ShufTy; if (ValVTy->isFloatingPointTy()) - ShufTy = VectorType::get(Type::getFloatTy(ValVTy->getContext()), 4); + ShufTy = + FixedVectorType::get(Type::getFloatTy(ValVTy->getContext()), 4); else - ShufTy = VectorType::get(Type::getInt32Ty(ValVTy->getContext()), 4); + ShufTy = + FixedVectorType::get(Type::getInt32Ty(ValVTy->getContext()), 4); ReductionCost += getShuffleCost(TTI::SK_PermuteSingleSrc, ShufTy, 0, nullptr); } else { @@ -3570,9 +3573,10 @@ if (LT.first != 1 && MTy.isVector() && MTy.getVectorNumElements() < ValVTy->getNumElements()) { // Type needs to be split. We need LT.first - 1 operations ops. - Ty = VectorType::get(ValVTy->getElementType(), MTy.getVectorNumElements()); - auto *SubCondTy = VectorType::get( - cast(CondTy)->getElementType(), MTy.getVectorNumElements()); + Ty = FixedVectorType::get(ValVTy->getElementType(), + MTy.getVectorNumElements()); + auto *SubCondTy = FixedVectorType::get(CondTy->getElementType(), + MTy.getVectorNumElements()); MinMaxCost = getMinMaxCost(Ty, SubCondTy, IsUnsigned); MinMaxCost *= LT.first - 1; NumVecElts = MTy.getVectorNumElements(); @@ -3611,7 +3615,7 @@ NumVecElts /= 2; // If we're reducing from 256/512 bits, use an extract_subvector. if (Size > 128) { - auto *SubTy = VectorType::get(ValVTy->getElementType(), NumVecElts); + auto *SubTy = FixedVectorType::get(ValVTy->getElementType(), NumVecElts); MinMaxCost += getShuffleCost(TTI::SK_ExtractSubvector, Ty, NumVecElts, SubTy); Ty = SubTy; @@ -3619,23 +3623,24 @@ // Reducing from 128 bits is a permute of v2f64/v2i64. VectorType *ShufTy; if (ValTy->isFloatingPointTy()) - ShufTy = VectorType::get(Type::getDoubleTy(ValTy->getContext()), 2); + ShufTy = + FixedVectorType::get(Type::getDoubleTy(ValTy->getContext()), 2); else - ShufTy = VectorType::get(Type::getInt64Ty(ValTy->getContext()), 2); + ShufTy = FixedVectorType::get(Type::getInt64Ty(ValTy->getContext()), 2); MinMaxCost += getShuffleCost(TTI::SK_PermuteSingleSrc, ShufTy, 0, nullptr); } else if (Size == 64) { // Reducing from 64 bits is a shuffle of v4f32/v4i32. - VectorType *ShufTy; + FixedVectorType *ShufTy; if (ValTy->isFloatingPointTy()) - ShufTy = VectorType::get(Type::getFloatTy(ValTy->getContext()), 4); + ShufTy = FixedVectorType::get(Type::getFloatTy(ValTy->getContext()), 4); else - ShufTy = VectorType::get(Type::getInt32Ty(ValTy->getContext()), 4); + ShufTy = FixedVectorType::get(Type::getInt32Ty(ValTy->getContext()), 4); MinMaxCost += getShuffleCost(TTI::SK_PermuteSingleSrc, ShufTy, 0, nullptr); } else { // Reducing from smaller size is a shift by immediate. - VectorType *ShiftTy = VectorType::get( + auto *ShiftTy = FixedVectorType::get( Type::getIntNTy(ValTy->getContext(), Size), 128 / Size); MinMaxCost += getArithmeticInstrCost( Instruction::LShr, ShiftTy, TTI::TCK_RecipThroughput, @@ -3918,8 +3923,8 @@ int MaskUnpackCost = 0; if (VariableMask) { - VectorType *MaskTy = - VectorType::get(Type::getInt1Ty(SrcVTy->getContext()), VF); + auto *MaskTy = + FixedVectorType::get(Type::getInt1Ty(SrcVTy->getContext()), VF); MaskUnpackCost = getScalarizationOverhead(MaskTy, DemandedElts, false, true); int ScalarCompareCost = @@ -4383,8 +4388,8 @@ // Get the cost of one memory operation. auto *SingleMemOpTy = - VectorType::get(cast(VecTy)->getElementType(), - LegalVT.getVectorNumElements()); + FixedVectorType::get(cast(VecTy)->getElementType(), + LegalVT.getVectorNumElements()); unsigned MemOpCost = getMemoryOpCost(Opcode, SingleMemOpTy, MaybeAlign(Alignment), AddressSpace, CostKind);