[llvm] [SLP] Update analyzeRtStrideCandidate() to correctly handle revectorization (PR #191878)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 13 14:11:06 PDT 2026


================
@@ -7355,14 +7355,19 @@ bool BoUpSLP::analyzeRtStrideCandidate(ArrayRef<Value *> PointerOps,
     if (Sz % NumOffsets != 0)
       return false;
     VecSz = Sz / NumOffsets;
+  }
+  if (NumOffsets > 1 || ScalarTy->isVectorTy())
     NewScalarTy = Type::getIntNTy(
         SE->getContext(),
         DL->getTypeSizeInBits(ScalarTy).getFixedValue() * NumOffsets);
-  }
   FixedVectorType *StridedLoadTy = getWidenedType(NewScalarTy, VecSz);
   unsigned MinProfitableStridedOps =
       IsLoad ? MinProfitableStridedLoads : MinProfitableStridedStores;
-  if (Sz <= MinProfitableStridedOps || !TTI->isTypeLegal(StridedLoadTy) ||
+  unsigned InputTyNumElts = 1;
+  if (auto *FVT = dyn_cast<FixedVectorType>(ScalarTy))
+    InputTyNumElts = FVT->getNumElements();
----------------
alexey-bataev wrote:

```suggestion
  unsigned InputTyNumElts = getNumElements(ScalarTy);
```

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


More information about the llvm-commits mailing list