[clang] [llvm] [LLVM][SROA] Teach SROA how to "bitcast" between fixed and scalable vectors. (PR #130973)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 29 02:56:49 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) {
+ if (SizeTy->getScalarType() == EltTy->getScalarType())
+ return SizeTy;
+
+ unsigned EltSize = EltTy->getScalarSizeInBits();
+ if (!SizeTy->getPrimitiveSizeInBits().isKnownMultipleOf(EltSize))
----------------
nikic wrote:
This should really be using DataLayout, not getPrimitiveSizeInBits.
https://github.com/llvm/llvm-project/pull/130973
More information about the llvm-commits
mailing list