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

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 16 03:40:36 PDT 2023


david-arm added a comment.

In D146128#4198864 <https://reviews.llvm.org/D146128#4198864>, @dmgreen wrote:

> LoopVectorizationLegality::containsDecreasingPointers seems to loop over all the instructions and call isConsecutivePtr, which just calls getPtrStride. Could that logic just be placed in AArch64TTIImpl::preferPredicateOverEpilogue? That is how it has worked in ARMTTIImpl::preferPredicateOverEpilogue via canTailPredicateLoop. Otherwise the code in containsDecreasingPointers is ran for any architecture, but only used by AArch64.

That's a good point @dmgreen! In fact, that's what I originally tried doing until I realised that `isConsecutivePtr` is a non-inline member function of LoopVectorizationLegality. Calling that function leads to build errors because that introduces a dependency on libLLVMVectorize.so. So then I had a few choices:

1. Make the AArch64 backend library depend upon libLLVMVectorize.so (which felt ugly),
2. Duplicate all of the code from `isConsecutivePtr` into AArch64TargetTransformInfo.cpp (also feels ugly and potentially misses bug fixes), or
3. Let the vectoriser do the discovery work and pass in a flag.

Unless you can think of a better way I've missed?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146128



More information about the llvm-commits mailing list