[llvm] [SLP][REVEC] Expand getelementptr into vector form. (PR #103704)
Han-Kuan Chen via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 19 02:22:44 PDT 2024
================
@@ -13760,6 +13760,26 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E, bool PostponedPHIs) {
LLVM_DEBUG(dbgs() << "SLP: Diamond merged for " << *VL0 << ".\n");
return E->VectorizedValue;
}
+ if (isa<FixedVectorType>(ScalarTy)) {
+ assert(SLPReVec && "FixedVectorType is not expected.");
+ // CreateMaskedGather expects VecTy and VecPtr have same size. We need
+ // to expand VecPtr if ScalarTy is a vector type.
+ unsigned ScalarTyNumElements =
+ cast<FixedVectorType>(ScalarTy)->getNumElements();
+ unsigned VecTyNumElements =
+ cast<FixedVectorType>(VecTy)->getNumElements();
+ SmallVector<Constant *> Indices(VecTyNumElements);
+ transform(seq(VecTyNumElements), Indices.begin(), [=](unsigned I) {
+ return Builder.getInt64(I % ScalarTyNumElements);
+ });
----------------
HanKuanChen wrote:
The data is read several time, but is not read in sequence. If we use CreateInsertVector to build the result, we still need CreateShuffleVector to permute.
https://github.com/llvm/llvm-project/pull/103704
More information about the llvm-commits
mailing list