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

Mel Chen via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 1 07:27:29 PST 2025


================
@@ -3307,6 +3332,52 @@ struct VPWidenLoadEVLRecipe final : public VPWidenMemoryRecipe, public VPValue {
   }
 };
 
+/// A recipe for strided load operations, using the base address, stride, and an
+/// optional mask. This recipe will generate an vp.strided.load intrinsic call
+/// to represent memory accesses with a fixed stride.
+struct VPWidenStridedLoadRecipe final : public VPWidenMemoryRecipe,
+                                        public VPValue {
+  VPWidenStridedLoadRecipe(LoadInst &Load, VPValue *Addr, VPValue *Stride,
----------------
Mel-Chen wrote:

I just thought of a possible approach: we could introduce a new class VPWidenMemoryIntrinsicRecipe that inherits from VPWidenIntrinsicRecipe and additionally keep alignment information as a member. This way, we don’t need to add a potentially unused AttributeList to VPWidenIntrinsicRecipe. We can pass the alignment directly, and computeCost() can also use alignment info to calculate the cost. @fhahn What do you think about this approach?

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


More information about the llvm-commits mailing list