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

Mikhail Gudim via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 14 12:54:40 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:

> Better to remove this check and generate correct stride here

I don't think we can remove this check. What if some other code (in `reorderTopToBottom()` for example) created reverse order?



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


More information about the llvm-commits mailing list