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,25 +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 { - ElementCount EC = getElementCount(); -#ifdef STRICT_FIXED_SIZE_VECTORS - assert(!EC.Scalable && - "Request for fixed number of elements from scalable vector"); - return EC.Min; -#else - if (EC.Scalable) - WithColor::warning() - << "The code that requested the fixed number of elements has made " - "the assumption that this vector is not scalable. This assumption " - "was not correct, and this may lead to broken code\n"; - return EC.Min; -#endif - } - Type *getElementType() const { return ContainedType; } /// This static method is the primary way to construct an VectorType. @@ -513,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); } @@ -543,6 +522,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; }