[PATCH] D146128: [SVE][LoopVectorize] Add option to disable tail-folding for reverse loops

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 24 11:42:03 PDT 2023


dmgreen added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp:3402
+                         .value_or(0);
+        if (Stride == -1)
+          return true;
----------------
sdesmalen wrote:
> david-arm wrote:
> > sdesmalen wrote:
> > > Does it also need to return `true` for Strides < -1?
> > In practice if abs(Stride) > 1 we will always version the loop and only enter the vectorised loop if abs(Stride)==1, but checking for all values < 0 doesn't do any harm.
> > In practice if abs(Stride) > 1 we will always version the loop and only enter the vectorised loop if abs(Stride)==1
> I thought that's only the case when the stride of the induction variable is unknown. It's still possible to use LD2/3/4 for known strides > 1 or vectorize a loop using gathers.
I think it will use gathers for <= -2. At least that is what it does for MVE, it may depend on the costs.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146128/new/

https://reviews.llvm.org/D146128



More information about the llvm-commits mailing list