Skip to content

Commit d52ca3d

Browse files
[SVE] Add specialized overloads of VectorType::get
Summary: Add overloads of get to FixedVectorType and ScalableVectorType that mirror VectorType::get(Type *Ty, VectorType *VTy) that take and return derived vector types Reviewers: efriedma, c-rhodes, david-arm, fpetrogalli Reviewed By: david-arm Subscribers: tschuett, rkruppe, psnobl, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D78841
1 parent 622aac6 commit d52ca3d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

llvm/include/llvm/IR/DerivedTypes.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,10 @@ class FixedVectorType : public VectorType {
549549
public:
550550
static FixedVectorType *get(Type *ElementType, unsigned NumElts);
551551

552+
static FixedVectorType *get(Type *ElementType, const FixedVectorType *FVTy) {
553+
return get(ElementType, FVTy->getNumElements());
554+
}
555+
552556
static bool classof(const Type *T) {
553557
return T->getTypeID() == FixedVectorTyID;
554558
}
@@ -563,6 +567,11 @@ class ScalableVectorType : public VectorType {
563567
public:
564568
static ScalableVectorType *get(Type *ElementType, unsigned MinNumElts);
565569

570+
static ScalableVectorType *get(Type *ElementType,
571+
const ScalableVectorType *SVTy) {
572+
return get(ElementType, SVTy->getMinNumElements());
573+
}
574+
566575
/// Get the minimum number of elements in this vector. The actual number of
567576
/// elements in the vector is an integer multiple of this value.
568577
uint64_t getMinNumElements() const { return ElementQuantity; }

0 commit comments

Comments
 (0)