================
@@ -554,6 +554,22 @@ class VectorType : public Type {
     return VectorType::get(VTy->getElementType(), EltCnt * 2);
   }
 
+  /// This static method returns a VectorType with the same size-in-bits as
+  /// SizeTy but with an element type that matches the scalar type of EltTy.
+  static VectorType *getWithSizeAndScalar(VectorType *SizeTy, Type *EltTy) {
----------------
paulwalker-arm wrote:

I really struggled to come up with a name that conveyed enough information 
whilst not causing all uses to overflow the 80 char line limit. This attempt 
being a shortened version of 
`get[VectorType]With[Total]Size[of_the_first_operand]AndScalar[Type_of_the 
second_operand]`. I'm not precious over this so suggestions are very welcome.

The downside of passing in a `TypeSize` is that I'd always have to create a new 
VectorType, whereas the current implementation has an early exit for the most 
common case of "casting" between fixed and scalable vectors of the same element 
type.

A lesser reason was it being awkward to convert between ElementCount and 
TypeSize and I wanted to avoid introducing another use of `getKnownMinValue()`.

Is this rational strong enough? or would you rather I go the `TypeSize` route?

https://github.com/llvm/llvm-project/pull/130973
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to