[LLVMdev] First attempt at recognizing pointer reduction

Renato Golin renato.golin at linaro.org
Wed Oct 23 13:10:48 PDT 2013


On 23 October 2013 16:05, Arnold Schwaighofer <aschwaighofer at apple.com>wrote:

> In the examples you gave there are no reduction variables in the loop
> vectorizer’s sense. But, they all have memory accesses that are strided.
>

This is what I don't get. As far as I understood, a reduction variable is
the one that aggregates the computation done by the loop, and is used
outside the loop.

In my example, I'm aggregating a computation in an array and returning this
array for later use, what am I missing here?


1.) analyze the memory accesses in the loop for strided accesses and deal
> with them appropriately during analysis and transformation
> 2.) be able to handle loops with non-unit stride integer induction
> variables - this only makes sense if we have support for 1.)
>

So, despite all this, we still have to pass validation, so canVectorize()
must return true. As it stands, all my examples can't vectorize because of
the extra memory PHI, and your example below can't vectorize because it
can't find the array bounds.

I'm assuming that, as soon as I teach the validation to accept your loop
(given additional checks), and teach about the strides and costs, it will
vectorize. But if I go back to my original code, it won't, because of the
reduction PHI.

So, again, I agree with you, one step at a time, I'll work with your loop,
because it's the straightest path from here. But at some time, I'll have to
either identify the memory PHIs or transform the loop to avoid them at all.
Does that make sense?

cheers,
--renato
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131023/47c22e7d/attachment.html>


More information about the llvm-dev mailing list