[llvm] [LV] Convert gather loads with invariant stride into strided loads (PR #147297)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 1 03:29:28 PDT 2025


================
@@ -3367,8 +3380,11 @@ InstructionCost VPWidenMemoryRecipe::computeCost(ElementCount VF,
            "Inconsecutive memory access should not have the order.");
 
     const Value *Ptr = getLoadStorePointerOperand(&Ingredient);
-    Type *PtrTy = Ptr->getType();
+    if (isa<VPWidenStridedLoadRecipe>(this))
+      return Ctx.TTI.getStridedMemoryOpCost(
+          Opcode, Ty, Ptr, IsMasked, Alignment, Ctx.CostKind, &Ingredient);
----------------
fhahn wrote:

Might be better to just implement `VPWidenStridedLoadRecipe::computeCost`, as it is basically completely separate from  the other hooks used here?

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


More information about the llvm-commits mailing list