<div dir="ltr">On 23 October 2013 16:05, Arnold Schwaighofer <span dir="ltr"><<a href="mailto:aschwaighofer@apple.com" target="_blank">aschwaighofer@apple.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><span style="color:rgb(34,34,34)">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.</span></div>

</blockquote><div><br></div><div>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.</div><div><br>
</div><div>In my example, I'm aggregating a computation in an array and returning this array for later use, what am I missing here?</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div><span style="color:rgb(34,34,34)">1.) analyze the memory accesses in the loop for strided accesses and deal with them appropriately during analysis and transformation</span><br></div>
2.) be able to handle loops with non-unit stride integer induction variables - this only makes sense if we have support for 1.)<br></blockquote><div><br></div><div>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.</div>
<div><br></div><div>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.</div>
<div><br></div><div>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?</div>
<div><br></div><div>cheers,</div><div>--renato</div></div></div></div>