diff --git a/llvm/include/llvm/IR/DerivedTypes.h b/llvm/include/llvm/IR/DerivedTypes.h --- a/llvm/include/llvm/IR/DerivedTypes.h +++ b/llvm/include/llvm/IR/DerivedTypes.h @@ -539,6 +539,10 @@ public: static FixedVectorType *get(Type *ElementType, unsigned NumElts); + static FixedVectorType *get(Type *ElementType, const FixedVectorType *FVTy) { + return get(ElementType, FVTy->getNumElements()); + } + static bool classof(const Type *T) { return T->getTypeID() == FixedVectorTyID; } @@ -553,6 +557,11 @@ public: static ScalableVectorType *get(Type *ElementType, unsigned MinNumElts); + static ScalableVectorType *get(Type *ElementType, + const ScalableVectorType *SVTy) { + return get(ElementType, SVTy->getMinNumElements()); + } + /// Get the minimum number of elements in this vector. The actual number of /// elements in the vector is an integer multiple of this value. uint64_t getMinNumElements() const { return ElementQuantity; }