[llvm] [LV] Support strided load with a stride of -1 (PR #128718)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 2 03:16:15 PDT 2025
================
@@ -8324,16 +8398,27 @@ VPRecipeBuilder::tryToWidenMemory(Instruction *I, ArrayRef<VPValue *> Operands,
// reverse consecutive.
LoopVectorizationCostModel::InstWidening Decision =
CM.getWideningDecision(I, Range.Start);
+
+ auto SameWiden = [&](ElementCount VF) -> bool {
+ return Decision == CM.getWideningDecision(I, VF);
+ };
+ bool ContainsWidenVF =
+ LoopVectorizationPlanner::getDecisionAndClampRange(SameWiden, Range);
+ assert(ContainsWidenVF &&
+ "At least widen the memory accesses by the Start VF.");
+
----------------
lukel97 wrote:
Just to check my understanding, with this patch do we now have different VFs with different widening decisions that now need pruned? E.g. CM_Strided for VF=1, CM_WidenReverse for VF=2? Was this an issue beforehand?
Also is this assert still needed? I think this is only checking `CM.getWideningDecision(I, Range.Start) == CM.getWideningDecision(I, Range.Start)`
https://github.com/llvm/llvm-project/pull/128718
More information about the llvm-commits
mailing list