[llvm] d52ca3d - [SVE] Add specialized overloads of VectorType::get

Christopher Tetreault via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 27 15:46:14 PDT 2020


Author: Christopher Tetreault
Date: 2020-04-27T15:45:57-07:00
New Revision: d52ca3d7e607de44825e3df300b180c2ad1ec3f9

URL: https://github.com/llvm/llvm-project/commit/d52ca3d7e607de44825e3df300b180c2ad1ec3f9
DIFF: https://github.com/llvm/llvm-project/commit/d52ca3d7e607de44825e3df300b180c2ad1ec3f9.diff

LOG: [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

Added: 
    

Modified: 
    llvm/include/llvm/IR/DerivedTypes.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/DerivedTypes.h b/llvm/include/llvm/IR/DerivedTypes.h
index e7af4cf7fbc5..e056f6fa3b6a 100644
--- a/llvm/include/llvm/IR/DerivedTypes.h
+++ b/llvm/include/llvm/IR/DerivedTypes.h
@@ -549,6 +549,10 @@ class FixedVectorType : public VectorType {
 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;
   }
@@ -563,6 +567,11 @@ class ScalableVectorType : public VectorType {
 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; }


        


More information about the llvm-commits mailing list