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 @@ -414,11 +414,6 @@ VectorType(const VectorType &) = delete; VectorType &operator=(const VectorType &) = delete; - /// Get the number of elements in this vector. It does not make sense to call - /// this function on a scalable vector, and this will be moved into - /// FixedVectorType in a future commit - unsigned getNumElements() const { return EC.Min; } - Type *getElementType() const { return ContainedType; } /// This static method is the primary way to construct an VectorType. @@ -499,8 +494,6 @@ /// input type and the same element type. static VectorType *getDoubleElementsVectorType(VectorType *VTy) { auto EltCnt = VTy->getElementCount(); - assert((VTy->getNumElements() * 2ull) <= UINT_MAX && - "Too many elements in vector"); return VectorType::get(VTy->getElementType(), EltCnt*2); } @@ -510,8 +503,6 @@ /// Return an ElementCount instance to represent the (possibly scalable) /// number of elements in the vector. ElementCount getElementCount() const { - uint64_t MinimumEltCnt = getNumElements(); - assert(MinimumEltCnt <= UINT_MAX && "Too many elements in vector"); return EC; } @@ -533,6 +524,9 @@ public: static FixedVectorType *get(Type *ElementType, unsigned NumElts); + /// Get the number of elements in this vector. + unsigned getNumElements() const { return getElementCount().Min; } + static bool classof(const Type *T) { return T->getTypeID() == FixedVectorTyID; }