[LLVMdev] loop vectorizer and storing to uniform addresses

Renato Golin renato.golin at linaro.org
Thu Nov 7 23:49:26 PST 2013


On 7 November 2013 17:18, Frank Winter <fwinter at jlab.org> wrote:

> LV: We don't allow storing to uniform addresses
>

This is triggering because it didn't recognize as a reduction variable
during the canVectorizeInstrs() but did recognize that sum[q] is loop
invariant in canVectorizeMemory().

I'm guessing the nested loop was unrolled because of the low trip-count,
and removed, so it ended up as:

float foo( int start , int end , float * A  )
{
  float sum[4] = {0.,0.,0.,0.};
  for (int i = start ; i < end ; ++i ) {
    sum[0] += A[i*4+0];
    sum[1] += A[i*4+1];
    sum[2] += A[i*4+2];
    sum[3] += A[i*4+3];
  }
  return sum[0]+sum[1]+sum[2]+sum[3];
}

but, for some reason, sum[q] wasn't recognized as a reduction variable,
maybe because it was an array of reduction variables?

Having the IR would certainly help...

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


More information about the llvm-dev mailing list