[clang] [llvm] [LLVM][SROA] Teach SROA how to "bitcast" between fixed and scalable vectors. (PR #130973)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 12 07:55:41 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff cd043e4fbe6125df4cb4993c625fa5e46194e478 cb6a620c93b3809742fd067233844221e74dde4f --extensions cpp,c,h -- clang/test/CodeGen/RISCV/attr-riscv-rvv-vector-bits-less-8-call.c clang/test/CodeGen/RISCV/attr-riscv-rvv-vector-bits-less-8-cast.c clang/test/CodeGen/RISCV/attr-rvv-vector-bits-cast.c clang/test/CodeGen/attr-arm-sve-vector-bits-cast.c llvm/include/llvm/IR/Attributes.h llvm/include/llvm/IR/DerivedTypes.h llvm/lib/IR/AttributeImpl.h llvm/lib/IR/Attributes.cpp llvm/lib/Transforms/Scalar/SROA.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/include/llvm/IR/DerivedTypes.h b/llvm/include/llvm/IR/DerivedTypes.h
index 6c8f416708..f8b79eea19 100644
--- a/llvm/include/llvm/IR/DerivedTypes.h
+++ b/llvm/include/llvm/IR/DerivedTypes.h
@@ -556,7 +556,7 @@ public:
/// 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) {
+ static VectorType *getWithSizeAndScalar(VectorType *SizeTy, Type *EltTy) {
if (SizeTy->getScalarType() == EltTy->getScalarType())
return SizeTy;
diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp
index 81a2b38410..2e758caa65 100644
--- a/llvm/lib/Transforms/Scalar/SROA.cpp
+++ b/llvm/lib/Transforms/Scalar/SROA.cpp
@@ -2198,8 +2198,7 @@ checkVectorTypesForPromotion(Partition &P, const DataLayout &DL,
SmallVectorImpl<VectorType *> &CandidateTys,
bool HaveCommonEltTy, Type *CommonEltTy,
bool HaveVecPtrTy, bool HaveCommonVecPtrTy,
- VectorType *CommonVecPtrTy,
- unsigned VScale) {
+ VectorType *CommonVecPtrTy, unsigned VScale) {
// If we didn't find a vector type, nothing to do here.
if (CandidateTys.empty())
return nullptr;
@@ -2311,9 +2310,9 @@ static VectorType *createAndCheckVectorTypesForPromotion(
}
}
- return checkVectorTypesForPromotion(P, DL, CandidateTys, HaveCommonEltTy,
- CommonEltTy, HaveVecPtrTy,
- HaveCommonVecPtrTy, CommonVecPtrTy, VScale);
+ return checkVectorTypesForPromotion(
+ P, DL, CandidateTys, HaveCommonEltTy, CommonEltTy, HaveVecPtrTy,
+ HaveCommonVecPtrTy, CommonVecPtrTy, VScale);
}
/// Test whether the given alloca partitioning and range of slices can be
@@ -2325,7 +2324,8 @@ static VectorType *createAndCheckVectorTypesForPromotion(
/// SSA value. We only can ensure this for a limited set of operations, and we
/// don't want to do the rewrites unless we are confident that the result will
/// be promotable, so we have an early test here.
-static VectorType *isVectorPromotionViable(Partition &P, const DataLayout &DL, unsigned VScale) {
+static VectorType *isVectorPromotionViable(Partition &P, const DataLayout &DL,
+ unsigned VScale) {
// Collect the candidate types for vector-based promotion. Also track whether
// we have different element types.
SmallVector<VectorType *, 4> CandidateTys;
``````````
</details>
https://github.com/llvm/llvm-project/pull/130973
More information about the cfe-commits
mailing list