[PATCH] D125301: [LoopVectorize] Add option to use active lane mask for loop control flow

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 25 03:26:06 PDT 2022


dmgreen added a comment.

In D125301#3536664 <https://reviews.llvm.org/D125301#3536664>, @david-arm wrote:

> In D125301#3536643 <https://reviews.llvm.org/D125301#3536643>, @dmgreen wrote:
>
>> Would it be better for this be done later, by the backend? I worry that the BETC would not be calculable any more for the loop, and the new structure would be more difficult to analyze in general. Handling it separately from the vectorizer would also allow other loops to be transformed. What happens at the moment for loops with ACLE intrinsics, for example?
>
> Hi @dmgreen, it's worth pointing out that this behaviour is toggled under a TTI interface so it is currently only enabled for SVE targets where this structure happens to be the most optimal. Any targets that rely upon the existing structure (e.g. MVE) remain unaffected.

Sure - that's good, but it wasn't my point. My point was that loops have a structure to them that usually includes latch block controlled by an induction variable. My worry is for SVE, if we are creating loops that do not have that structure. Do all the transforms such as LSR and anything that might happen in an LTO pipeline still behave optimally, or do they work less well because the loop is less analyzable.  A simple example that comes up quite a lot is that during the compile step of lto the loop is vectorized, then during the lto step the trip count becomes a known constant. The loop should be fully unrolled and simplified away nicely. I think the simplification should still happen given the chance because the activelanemask will propagate constants, but would the unrolling happen if the trip count is not obvious any more? There may be any number of other similar transforms that could happen during an LTO phase.

I haven't looked at the details, it sounds like this is a good thing to do. But my gut would say don't mess with the structure of the loop in the vectorizer, do the transform later.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125301



More information about the llvm-commits mailing list