These new getters in the derived vector types provide consistency with
all the other derived get functions. Prior to this change, if a
developer were to write:
auto *VTy = FixedVectorType::get(SomeTy, SomeVTy->getElementCount())
Not only is the type of VTy VectorType, which is inconsistent with how
all the other getters work when called through a derived vector type
get() function, but it might even actually be an instance of
ScalableVectorType, which is almost certainly not what the caller
expects.
This patch adds get functions that ensure that all base VectorType are
hidden when called via a derived vector type. When these functions are
called, if the result would not have matched the requested type, nullptr
is returned. This enables patterns like:
if (auto *SVTy = ScalableVectorType::get(SomeTy, SomeVTy)) {
// stuff
... where if SomeVTy is a fixed width vector, the branch will not be
taken.