[clang] [llvm] [LLVM][SROA] Teach SROA how to "bitcast" between fixed and scalable vectors. (PR #130973)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 10 08:40:44 PDT 2025


================
@@ -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) {
----------------
sdesmalen-arm wrote:

nit: This name does not describe what the function does. "Size" parameter `SizeTy` is not a size, but a vector type. And the "Scalar" parameter `EltTy` is not necessarily a scalar, but can be a vector.

To me it would be less confusing if this were:
```suggestion
  static VectorType *getWithSizeAndScalar(TypeSize *Size, Type *EltTy) {
```
where EltTy is a `scalar` type.

https://github.com/llvm/llvm-project/pull/130973


More information about the llvm-commits mailing list