[llvm] [SLPVectorizer][NFC] Save stride in a map. (PR #157706)

Mikhail Gudim via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 12 08:07:42 PDT 2025


================
@@ -13030,10 +13063,18 @@ void BoUpSLP::transformNodes() {
         InstructionCost StridedCost = TTI->getStridedMemoryOpCost(
             Instruction::Load, VecTy, BaseLI->getPointerOperand(),
             /*VariableMask=*/false, CommonAlignment, CostKind, BaseLI);
-        if (StridedCost < OriginalVecCost)
+        if (StridedCost < OriginalVecCost) {
           // Strided load is more profitable than consecutive load + reverse -
           // transform the node to strided load.
+          Type *StrideTy = DL->getIndexType(cast<LoadInst>(E.Scalars.front())
+                                                ->getPointerOperand()
+                                                ->getType());
+          StridedPtrInfo SPtrInfo;
+          SPtrInfo.StrideVal = ConstantInt::get(StrideTy, 1);
----------------
mgudim wrote:

@alexey-bataev Since it is pretty hard to make slp generate -1 stride, can I add CLI options for testing purpuses? This way we can test that -1 stride change and move on with the load widening.

I can look at the cost model issue later.

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


More information about the llvm-commits mailing list