[llvm] [LoopVectorize] Enable vectorisation of early exit loops with live-outs (PR #120567)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 21 05:56:24 PST 2025
https://github.com/fhahn commented:
> > > > Just double checking, looking at the latest version it is effectively doing an extract of the last active lane, right?
> > >
> > >
> > > Hi @fhahn, no it extracts the first active lane by counting the number of trailing zeroes in the mask that triggered the exit. So it's calculating the element corresponding to the first true value in the mask. If it was extracting the last active lane then it would be VF - number of leading zeroes.
> >
> >
> > Yeah I meant just that it only extracts from last valid lane of the vector IV, not how exactly that is computed (vs computing the end value based on the IV end value)
>
> Yeah that's true. There are two different ways of thinking about this:
>
> 1. We're extracting the lane corresponding to the first true value in the exit mask, or
> 2. We're extracting the last valid lane of the loop-defined vector variable, since values in higher lanes correspond to values beyond the loop exit.
>
> I've named the new VPInstruction in terms of the former because I thought that more closely matches the operation. Although I can see it depends upon your perspective!
OK great! (Was originally a bit confused as it looks like you modified my original comment but I assumed you meant to post this as new response :)
https://github.com/llvm/llvm-project/pull/120567
More information about the llvm-commits
mailing list