[llvm] [SLPVectorizer][NFC] Save stride in a map. (PR #157706)
    Mikhail Gudim via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Fri Sep 12 06:21:50 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:
In `RISCVTargetTransformInfo` I see this line `unsigned NumLoads = getEstimatedVLFor(VTy);` used to get how many regular loads is equivalent to strided access. But why is it true for all implementations? What if some implementations loads `x` elements of every cycle where `x != 1`?
https://github.com/llvm/llvm-project/pull/157706
    
    
More information about the llvm-commits
mailing list