diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp --- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -839,7 +839,7 @@ Index /= 8; Type *IntTy8 = Type::getInt8Ty(II.getContext()); - VectorType *ShufTy = VectorType::get(IntTy8, 16); + auto *ShufTy = FixedVectorType::get(IntTy8, 16); SmallVector ShuffleMask; for (int i = 0; i != (int)Length; ++i) @@ -916,7 +916,7 @@ Index /= 8; Type *IntTy8 = Type::getInt8Ty(II.getContext()); - VectorType *ShufTy = VectorType::get(IntTy8, 16); + auto *ShufTy = FixedVectorType::get(IntTy8, 16); SmallVector ShuffleMask; for (int i = 0; i != (int)Index; ++i) @@ -2849,8 +2849,9 @@ // We don't need a select if we know the mask bit is a 1. if (!C || !C->getValue()[0]) { // Cast the mask to an i1 vector and then extract the lowest element. - auto *MaskTy = VectorType::get(Builder.getInt1Ty(), - cast(Mask->getType())->getBitWidth()); + auto *MaskTy = FixedVectorType::get( + Builder.getInt1Ty(), + cast(Mask->getType())->getBitWidth()); Mask = Builder.CreateBitCast(Mask, MaskTy); Mask = Builder.CreateExtractElement(Mask, (uint64_t)0); // Extract the lowest element from the passthru operand. diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp --- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp @@ -483,7 +483,7 @@ // bitcast it to a vector type that we can extract from. unsigned NumVecElts = VecWidth / DestWidth; if (VecType->getElementType() != DestType) { - VecType = VectorType::get(DestType, NumVecElts); + VecType = FixedVectorType::get(DestType, NumVecElts); VecInput = IC.Builder.CreateBitCast(VecInput, VecType, "bc"); } @@ -870,7 +870,7 @@ assert(BitCastNumElts <= std::numeric_limits::max() && "overflow 32-bits"); - Type *BitCastTo = VectorType::get(DestTy, BitCastNumElts); + auto *BitCastTo = FixedVectorType::get(DestTy, BitCastNumElts); Value *BitCast = Builder.CreateBitCast(VecOp, BitCastTo); return ExtractElementInst::Create(BitCast, Builder.getInt32(NewIdx)); } @@ -1536,7 +1536,7 @@ } // Make a vector type from the minimal type. - return VectorType::get(MinType, NumElts); + return FixedVectorType::get(MinType, NumElts); } /// Find the minimum FP type we can safely truncate to. @@ -1921,8 +1921,11 @@ return commonPointerCastTransforms(CI); Type *PtrTy = DL.getIntPtrType(CI.getContext(), AS); - if (auto *VTy = dyn_cast(Ty)) // Handle vectors of pointers. - PtrTy = VectorType::get(PtrTy, VTy->getNumElements()); + if (auto *VTy = dyn_cast(Ty)) { + // Handle vectors of pointers. + // FIXME: what should happen for scalable vectors? + PtrTy = FixedVectorType::get(PtrTy, VTy->getNumElements()); + } Value *P = Builder.CreatePtrToInt(CI.getOperand(0), PtrTy); return CastInst::CreateIntegerCast(P, Ty, /*isSigned=*/false); @@ -1961,7 +1964,8 @@ DestTy->getElementType()->getPrimitiveSizeInBits()) return nullptr; - SrcTy = VectorType::get(DestTy->getElementType(), SrcTy->getNumElements()); + SrcTy = + FixedVectorType::get(DestTy->getElementType(), SrcTy->getNumElements()); InVal = IC.Builder.CreateBitCast(InVal, SrcTy); } @@ -2187,7 +2191,7 @@ return nullptr; unsigned NumElts = ExtElt->getVectorOperandType()->getNumElements(); - auto *NewVecType = VectorType::get(DestType, NumElts); + auto *NewVecType = FixedVectorType::get(DestType, NumElts); auto *NewBC = IC.Builder.CreateBitCast(ExtElt->getVectorOperand(), NewVecType, "bc"); return ExtractElementInst::Create(NewBC, ExtElt->getIndexOperand()); @@ -2658,7 +2662,8 @@ Type *MidTy = PointerType::get(DestElemTy, SrcTy->getAddressSpace()); if (VectorType *VT = dyn_cast(CI.getType())) { // Handle vectors of pointers. - MidTy = VectorType::get(MidTy, VT->getNumElements()); + // FIXME: what should happen for scalable vectors? + MidTy = FixedVectorType::get(MidTy, VT->getNumElements()); } Value *NewBitCast = Builder.CreateBitCast(Src, MidTy); diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -1862,7 +1862,7 @@ if (ExactLogBase2 != -1 && DL.isLegalInteger(ExactLogBase2 + 1)) { Type *NTy = IntegerType::get(Cmp.getContext(), ExactLogBase2 + 1); if (auto *AndVTy = dyn_cast(And->getType())) - NTy = VectorType::get(NTy, AndVTy->getNumElements()); + NTy = FixedVectorType::get(NTy, AndVTy->getNumElements()); Value *Trunc = Builder.CreateTrunc(X, NTy); auto NewPred = Cmp.getPredicate() == CmpInst::ICMP_EQ ? CmpInst::ICMP_SGE : CmpInst::ICMP_SLT; @@ -2152,7 +2152,7 @@ DL.isLegalInteger(TypeBits - Amt)) { Type *TruncTy = IntegerType::get(Cmp.getContext(), TypeBits - Amt); if (auto *ShVTy = dyn_cast(ShType)) - TruncTy = VectorType::get(TruncTy, ShVTy->getNumElements()); + TruncTy = FixedVectorType::get(TruncTy, ShVTy->getNumElements()); Constant *NewC = ConstantInt::get(TruncTy, C.ashr(*ShiftAmt).trunc(TypeBits - Amt)); return new ICmpInst(Pred, Builder.CreateTrunc(X, TruncTy), NewC); @@ -2785,7 +2785,7 @@ Type *NewType = Builder.getIntNTy(XType->getScalarSizeInBits()); if (auto *XVTy = dyn_cast(XType)) - NewType = VectorType::get(NewType, XVTy->getNumElements()); + NewType = FixedVectorType::get(NewType, XVTy->getNumElements()); Value *NewBitcast = Builder.CreateBitCast(X, NewType); if (TrueIfSigned) return new ICmpInst(ICmpInst::ICMP_SLT, NewBitcast, diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp --- a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp @@ -1144,7 +1144,8 @@ Module *M = II->getParent()->getParent()->getParent(); Type *EltTy = IIVTy->getElementType(); - Type *NewTy = (NewNumElts == 1) ? EltTy : VectorType::get(EltTy, NewNumElts); + Type *NewTy = + (NewNumElts == 1) ? EltTy : FixedVectorType::get(EltTy, NewNumElts); OverloadTys[0] = NewTy; Function *NewIntrin = Intrinsic::getDeclaration(M, IID, OverloadTys); diff --git a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp --- a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp @@ -1336,10 +1336,10 @@ Type *EltTy = V->getType()->getScalarType(); Type *I32Ty = IntegerType::getInt32Ty(V->getContext()); if (isa(V)) - return UndefValue::get(VectorType::get(EltTy, Mask.size())); + return UndefValue::get(FixedVectorType::get(EltTy, Mask.size())); if (isa(V)) - return ConstantAggregateZero::get(VectorType::get(EltTy, Mask.size())); + return ConstantAggregateZero::get(FixedVectorType::get(EltTy, Mask.size())); if (Constant *C = dyn_cast(V)) return ConstantExpr::getShuffleVector(C, UndefValue::get(C->getType()), @@ -2131,7 +2131,7 @@ continue; if (!VectorType::isValidElementType(TgtTy)) continue; - VectorType *CastSrcTy = VectorType::get(TgtTy, TgtNumElems); + auto *CastSrcTy = FixedVectorType::get(TgtTy, TgtNumElems); if (!BegIsAligned) { // Shuffle the input so [0,NumElements) contains the output, and // [NumElems,SrcNumElems) is undef.