[llvm] [LV] Support strided load with a stride of -1 (PR #128718)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon May 12 11:36:13 PDT 2025


================
@@ -1115,6 +1115,7 @@ class LoopVectorizationCostModel {
     CM_Widen_Reverse, // For consecutive accesses with stride -1.
     CM_Interleave,
     CM_GatherScatter,
+    CM_Strided,
----------------
fhahn wrote:

Thanks for sharing the examples.

At least for interleave-groups, we already have a transform that removes interleave groups if possible (https://github.com/llvm/llvm-project/blob/main/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp#L2685). I think the same could be done to replace it with strided/loads stores without too much complexity? Granted requiring scalar epilogue needs more thoughts, but that should also be solvable, and doesn't need to be included in the initial patches.

I've not yet checked the recipes generated for the gather-scatter example, but I think we should also be able to handle this in VPlan. If not, would be good to know at least what would be missing

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


More information about the llvm-commits mailing list