diff --git a/llvm/include/llvm/IR/MatrixBuilder.h b/llvm/include/llvm/IR/MatrixBuilder.h --- a/llvm/include/llvm/IR/MatrixBuilder.h +++ b/llvm/include/llvm/IR/MatrixBuilder.h @@ -49,7 +49,7 @@ PointerType *PtrTy = cast(DataPtr->getType()); Type *EltTy = PtrTy->getElementType(); - Type *RetType = VectorType::get(EltTy, Rows * Columns); + auto *RetType = FixedVectorType::get(EltTy, Rows * Columns); Value *Ops[] = {DataPtr, Stride, B.getInt32(Rows), B.getInt32(Columns)}; Type *OverloadedTypes[] = {RetType, PtrTy}; @@ -82,8 +82,8 @@ CallInst *CreateMatrixTranspose(Value *Matrix, unsigned Rows, unsigned Columns, const Twine &Name = "") { auto *OpType = cast(Matrix->getType()); - Type *ReturnType = - VectorType::get(OpType->getElementType(), Rows * Columns); + auto *ReturnType = + FixedVectorType::get(OpType->getElementType(), Rows * Columns); Type *OverloadedTypes[] = {ReturnType}; Value *Ops[] = {Matrix, B.getInt32(Rows), B.getInt32(Columns)}; @@ -101,8 +101,8 @@ auto *LHSType = cast(LHS->getType()); auto *RHSType = cast(RHS->getType()); - Type *ReturnType = - VectorType::get(LHSType->getElementType(), LHSRows * RHSColumns); + auto *ReturnType = + FixedVectorType::get(LHSType->getElementType(), LHSRows * RHSColumns); Value *Ops[] = {LHS, RHS, B.getInt32(LHSRows), B.getInt32(LHSColumns), B.getInt32(RHSColumns)}; diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp --- a/llvm/lib/IR/AutoUpgrade.cpp +++ b/llvm/lib/IR/AutoUpgrade.cpp @@ -42,7 +42,7 @@ // Check whether this is an old version of the function, which received // v4f32 arguments. Type *Arg0Type = F->getFunctionType()->getParamType(0); - if (Arg0Type != VectorType::get(Type::getFloatTy(F->getContext()), 4)) + if (Arg0Type != FixedVectorType::get(Type::getFloatTy(F->getContext()), 4)) return false; // Yes, it's old, replace it with new version. @@ -903,7 +903,7 @@ unsigned NumElts = ResultTy->getNumElements() * 8; // Bitcast from a 64-bit element type to a byte element type. - Type *VecTy = VectorType::get(Builder.getInt8Ty(), NumElts); + Type *VecTy = FixedVectorType::get(Builder.getInt8Ty(), NumElts); Op = Builder.CreateBitCast(Op, VecTy, "cast"); // We'll be shuffling in zeroes. @@ -937,7 +937,7 @@ unsigned NumElts = ResultTy->getNumElements() * 8; // Bitcast from a 64-bit element type to a byte element type. - Type *VecTy = VectorType::get(Builder.getInt8Ty(), NumElts); + Type *VecTy = FixedVectorType::get(Builder.getInt8Ty(), NumElts); Op = Builder.CreateBitCast(Op, VecTy, "cast"); // We'll be shuffling in zeroes. @@ -965,8 +965,8 @@ static Value *getX86MaskVec(IRBuilder<> &Builder, Value *Mask, unsigned NumElts) { - llvm::VectorType *MaskTy = llvm::VectorType::get(Builder.getInt1Ty(), - cast(Mask->getType())->getBitWidth()); + llvm::VectorType *MaskTy = FixedVectorType::get( + Builder.getInt1Ty(), cast(Mask->getType())->getBitWidth()); Mask = Builder.CreateBitCast(Mask, MaskTy); // If we have less than 8 elements, then the starting mask was an i8 and @@ -1002,9 +1002,8 @@ if (C->isAllOnesValue()) return Op0; - llvm::VectorType *MaskTy = - llvm::VectorType::get(Builder.getInt1Ty(), - Mask->getType()->getIntegerBitWidth()); + auto *MaskTy = FixedVectorType::get(Builder.getInt1Ty(), + Mask->getType()->getIntegerBitWidth()); Mask = Builder.CreateBitCast(Mask, MaskTy); Mask = Builder.CreateExtractElement(Mask, (uint64_t)0); return Builder.CreateSelect(Mask, Op0, Op1); @@ -1371,9 +1370,11 @@ Value *Cmp; if (CC == 3) { - Cmp = Constant::getNullValue(llvm::VectorType::get(Builder.getInt1Ty(), NumElts)); + Cmp = Constant::getNullValue( + FixedVectorType::get(Builder.getInt1Ty(), NumElts)); } else if (CC == 7) { - Cmp = Constant::getAllOnesValue(llvm::VectorType::get(Builder.getInt1Ty(), NumElts)); + Cmp = Constant::getAllOnesValue( + FixedVectorType::get(Builder.getInt1Ty(), NumElts)); } else { ICmpInst::Predicate Pred; switch (CC) { @@ -1756,7 +1757,7 @@ Value *Arg0 = CI->getArgOperand(0); Value *Arg1 = CI->getArgOperand(1); - Type *NewVecTy = VectorType::get(Type::getInt64Ty(C), 2); + auto *NewVecTy = FixedVectorType::get(Type::getInt64Ty(C), 2); Value *BC0 = Builder.CreateBitCast(Arg1, NewVecTy, "cast"); Value *Elt = Builder.CreateExtractElement(BC0, (uint64_t)0); Value *BC = Builder.CreateBitCast(Arg0, @@ -2161,7 +2162,7 @@ Rep = Builder.CreateShuffleVector(Rep, Rep, ArrayRef{0, 1, 2, 3}); } Rep = Builder.CreateBitCast( - Rep, VectorType::get(Type::getHalfTy(C), NumDstElts)); + Rep, FixedVectorType::get(Type::getHalfTy(C), NumDstElts)); Rep = Builder.CreateFPExt(Rep, DstTy, "cvtph2ps"); if (CI->getNumArgOperands() >= 3) Rep = EmitX86Select(Builder, CI->getArgOperand(2), Rep, @@ -2335,7 +2336,7 @@ // Replace vbroadcastf128/vbroadcasti128 with a vector load+shuffle. Type *EltTy = cast(CI->getType())->getElementType(); unsigned NumSrcElts = 128 / EltTy->getPrimitiveSizeInBits(); - Type *VT = VectorType::get(EltTy, NumSrcElts); + auto *VT = FixedVectorType::get(EltTy, NumSrcElts); Value *Op = Builder.CreatePointerCast(CI->getArgOperand(0), PointerType::getUnqual(VT)); Value *Load = Builder.CreateAlignedLoad(VT, Op, Align(1)); @@ -3658,13 +3659,13 @@ // So, the only thing required is a bitcast for both arguments. // First, check the arguments have the old type. Value *Arg0 = CI->getArgOperand(0); - if (Arg0->getType() != VectorType::get(Type::getFloatTy(C), 4)) + if (Arg0->getType() != FixedVectorType::get(Type::getFloatTy(C), 4)) return; // Old intrinsic, add bitcasts Value *Arg1 = CI->getArgOperand(1); - Type *NewVecTy = VectorType::get(Type::getInt64Ty(C), 2); + auto *NewVecTy = FixedVectorType::get(Type::getInt64Ty(C), 2); Value *BC0 = Builder.CreateBitCast(Arg0, NewVecTy, "cast"); Value *BC1 = Builder.CreateBitCast(Arg1, NewVecTy, "cast"); diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp --- a/llvm/lib/IR/ConstantFold.cpp +++ b/llvm/lib/IR/ConstantFold.cpp @@ -881,7 +881,7 @@ // Undefined shuffle mask -> undefined value. if (all_of(Mask, [](int Elt) { return Elt == UndefMaskElem; })) { - return UndefValue::get(VectorType::get(EltTy, MaskNumElts)); + return UndefValue::get(FixedVectorType::get(EltTy, MaskNumElts)); } // If the mask is all zeros this is a splat, no need to go through all @@ -2286,13 +2286,13 @@ Type *OrigGEPTy = PointerType::get(Ty, PtrTy->getAddressSpace()); Type *GEPTy = PointerType::get(Ty, PtrTy->getAddressSpace()); if (VectorType *VT = dyn_cast(C->getType())) - GEPTy = VectorType::get(OrigGEPTy, VT->getNumElements()); + GEPTy = FixedVectorType::get(OrigGEPTy, VT->getNumElements()); // The GEP returns a vector of pointers when one of more of // its arguments is a vector. for (unsigned i = 0, e = Idxs.size(); i != e; ++i) { if (auto *VT = dyn_cast(Idxs[i]->getType())) { - GEPTy = VectorType::get(OrigGEPTy, VT->getNumElements()); + GEPTy = FixedVectorType::get(OrigGEPTy, VT->getNumElements()); break; } } @@ -2527,7 +2527,7 @@ // overflow trouble. Type *ExtendedTy = Type::getIntNTy(Div->getContext(), CommonExtendedWidth); if (UseVector) - ExtendedTy = VectorType::get( + ExtendedTy = FixedVectorType::get( ExtendedTy, IsPrevIdxVector ? cast(PrevIdx->getType())->getNumElements() diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp --- a/llvm/lib/IR/Constants.cpp +++ b/llvm/lib/IR/Constants.cpp @@ -1187,13 +1187,13 @@ Constant *ConstantVector::get(ArrayRef V) { if (Constant *C = getImpl(V)) return C; - VectorType *Ty = VectorType::get(V.front()->getType(), V.size()); + auto *Ty = FixedVectorType::get(V.front()->getType(), V.size()); return Ty->getContext().pImpl->VectorConstants.getOrCreate(Ty, V); } Constant *ConstantVector::getImpl(ArrayRef V) { assert(!V.empty() && "Vectors can't be empty"); - VectorType *T = VectorType::get(V.front()->getType(), V.size()); + auto *T = FixedVectorType::get(V.front()->getType(), V.size()); // If this is an all-undef or all-zero vector, return a // ConstantAggregateZero or UndefValue. @@ -1962,7 +1962,7 @@ Type *MidTy = PointerType::get(DstElemTy, SrcScalarTy->getAddressSpace()); if (VectorType *VT = dyn_cast(DstTy)) { // Handle vectors of pointers. - MidTy = VectorType::get(MidTy, VT->getNumElements()); + MidTy = FixedVectorType::get(MidTy, VT->getNumElements()); } C = getBitCast(C, MidTy); } @@ -2744,32 +2744,32 @@ /// count and element type matching the ArrayRef passed in. Note that this /// can return a ConstantAggregateZero object. Constant *ConstantDataVector::get(LLVMContext &Context, ArrayRef Elts){ - Type *Ty = VectorType::get(Type::getInt8Ty(Context), Elts.size()); + auto *Ty = FixedVectorType::get(Type::getInt8Ty(Context), Elts.size()); const char *Data = reinterpret_cast(Elts.data()); return getImpl(StringRef(Data, Elts.size() * 1), Ty); } Constant *ConstantDataVector::get(LLVMContext &Context, ArrayRef Elts){ - Type *Ty = VectorType::get(Type::getInt16Ty(Context), Elts.size()); + auto *Ty = FixedVectorType::get(Type::getInt16Ty(Context), Elts.size()); const char *Data = reinterpret_cast(Elts.data()); return getImpl(StringRef(Data, Elts.size() * 2), Ty); } Constant *ConstantDataVector::get(LLVMContext &Context, ArrayRef Elts){ - Type *Ty = VectorType::get(Type::getInt32Ty(Context), Elts.size()); + auto *Ty = FixedVectorType::get(Type::getInt32Ty(Context), Elts.size()); const char *Data = reinterpret_cast(Elts.data()); return getImpl(StringRef(Data, Elts.size() * 4), Ty); } Constant *ConstantDataVector::get(LLVMContext &Context, ArrayRef Elts){ - Type *Ty = VectorType::get(Type::getInt64Ty(Context), Elts.size()); + auto *Ty = FixedVectorType::get(Type::getInt64Ty(Context), Elts.size()); const char *Data = reinterpret_cast(Elts.data()); return getImpl(StringRef(Data, Elts.size() * 8), Ty); } Constant *ConstantDataVector::get(LLVMContext &Context, ArrayRef Elts) { - Type *Ty = VectorType::get(Type::getFloatTy(Context), Elts.size()); + auto *Ty = FixedVectorType::get(Type::getFloatTy(Context), Elts.size()); const char *Data = reinterpret_cast(Elts.data()); return getImpl(StringRef(Data, Elts.size() * 4), Ty); } Constant *ConstantDataVector::get(LLVMContext &Context, ArrayRef Elts) { - Type *Ty = VectorType::get(Type::getDoubleTy(Context), Elts.size()); + auto *Ty = FixedVectorType::get(Type::getDoubleTy(Context), Elts.size()); const char *Data = reinterpret_cast(Elts.data()); return getImpl(StringRef(Data, Elts.size() * 8), Ty); } @@ -2784,14 +2784,14 @@ ArrayRef Elts) { assert((ElementType->isHalfTy() || ElementType->isBFloatTy()) && "Element type is not a 16-bit float type"); - Type *Ty = VectorType::get(ElementType, Elts.size()); + auto *Ty = FixedVectorType::get(ElementType, Elts.size()); const char *Data = reinterpret_cast(Elts.data()); return getImpl(StringRef(Data, Elts.size() * 2), Ty); } Constant *ConstantDataVector::getFP(Type *ElementType, ArrayRef Elts) { assert(ElementType->isFloatTy() && "Element type is not a 32-bit float type"); - Type *Ty = VectorType::get(ElementType, Elts.size()); + auto *Ty = FixedVectorType::get(ElementType, Elts.size()); const char *Data = reinterpret_cast(Elts.data()); return getImpl(StringRef(Data, Elts.size() * 4), Ty); } @@ -2799,7 +2799,7 @@ ArrayRef Elts) { assert(ElementType->isDoubleTy() && "Element type is not a 64-bit float type"); - Type *Ty = VectorType::get(ElementType, Elts.size()); + auto *Ty = FixedVectorType::get(ElementType, Elts.size()); const char *Data = reinterpret_cast(Elts.data()); return getImpl(StringRef(Data, Elts.size() * 8), Ty); } diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp --- a/llvm/lib/IR/Core.cpp +++ b/llvm/lib/IR/Core.cpp @@ -756,7 +756,7 @@ } LLVMTypeRef LLVMVectorType(LLVMTypeRef ElementType, unsigned ElementCount) { - return wrap(VectorType::get(unwrap(ElementType), ElementCount)); + return wrap(FixedVectorType::get(unwrap(ElementType), ElementCount)); } LLVMTypeRef LLVMGetElementType(LLVMTypeRef WrappedTy) { diff --git a/llvm/lib/IR/DataLayout.cpp b/llvm/lib/IR/DataLayout.cpp --- a/llvm/lib/IR/DataLayout.cpp +++ b/llvm/lib/IR/DataLayout.cpp @@ -792,7 +792,7 @@ unsigned NumBits = getPointerTypeSizeInBits(Ty); IntegerType *IntTy = IntegerType::get(Ty->getContext(), NumBits); if (VectorType *VecTy = dyn_cast(Ty)) - return VectorType::get(IntTy, VecTy->getNumElements()); + return FixedVectorType::get(IntTy, VecTy->getNumElements()); return IntTy; } @@ -814,7 +814,7 @@ unsigned NumBits = getIndexTypeSizeInBits(Ty); IntegerType *IntTy = IntegerType::get(Ty->getContext(), NumBits); if (VectorType *VecTy = dyn_cast(Ty)) - return VectorType::get(IntTy, VecTy->getNumElements()); + return FixedVectorType::get(IntTy, VecTy->getNumElements()); return IntTy; } diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -1008,7 +1008,8 @@ case IITDescriptor::Integer: return IntegerType::get(Context, D.Integer_Width); case IITDescriptor::Vector: - return VectorType::get(DecodeFixedType(Infos, Tys, Context),D.Vector_Width); + return FixedVectorType::get(DecodeFixedType(Infos, Tys, Context), + D.Vector_Width); case IITDescriptor::Pointer: return PointerType::get(DecodeFixedType(Infos, Tys, Context), D.Pointer_AddressSpace); diff --git a/llvm/lib/IR/IRBuilder.cpp b/llvm/lib/IR/IRBuilder.cpp --- a/llvm/lib/IR/IRBuilder.cpp +++ b/llvm/lib/IR/IRBuilder.cpp @@ -525,11 +525,11 @@ auto PtrsTy = cast(Ptrs->getType()); auto PtrTy = cast(PtrsTy->getElementType()); unsigned NumElts = PtrsTy->getNumElements(); - Type *DataTy = VectorType::get(PtrTy->getElementType(), NumElts); + auto *DataTy = FixedVectorType::get(PtrTy->getElementType(), NumElts); if (!Mask) - Mask = Constant::getAllOnesValue(VectorType::get(Type::getInt1Ty(Context), - NumElts)); + Mask = Constant::getAllOnesValue( + FixedVectorType::get(Type::getInt1Ty(Context), NumElts)); if (!PassThru) PassThru = UndefValue::get(DataTy); @@ -564,8 +564,8 @@ #endif if (!Mask) - Mask = Constant::getAllOnesValue(VectorType::get(Type::getInt1Ty(Context), - NumElts)); + Mask = Constant::getAllOnesValue( + FixedVectorType::get(Type::getInt1Ty(Context), NumElts)); Type *OverloadedTypes[] = {DataTy, PtrsTy}; Value *Ops[] = {Data, Ptrs, getInt32(Alignment.value()), Mask}; @@ -968,12 +968,13 @@ // First insert it into an undef vector so we can shuffle it. Type *I32Ty = getInt32Ty(); - Value *Undef = UndefValue::get(VectorType::get(V->getType(), NumElts)); + Value *Undef = UndefValue::get(FixedVectorType::get(V->getType(), NumElts)); V = CreateInsertElement(Undef, V, ConstantInt::get(I32Ty, 0), Name + ".splatinsert"); // Shuffle the value across the desired number of elements. - Value *Zeros = ConstantAggregateZero::get(VectorType::get(I32Ty, NumElts)); + Value *Zeros = + ConstantAggregateZero::get(FixedVectorType::get(I32Ty, NumElts)); return CreateShuffleVector(V, Undef, Zeros, Name + ".splat"); }