[LLVMdev] parallel loop metadata simplification

Pekka Jääskeläinen pekka.jaaskelainen at tut.fi
Sun Mar 3 06:34:39 PST 2013

On 03/03/2013 02:34 PM, Tobias Grosser wrote:
> Meaning they are due to an array or pointer access.

What about loop-scope arrays?

void foo(long *A, long b) {
     long i;

     #pragma ivdep
     for (i = 0; i < 100; i++) {
         long t[100];
         t[0] = i + 2;
         A[i] = A[i+b] + t[0];

Clang places the alloca for t to the entry block, creating
a new race condition.

In your example where you moved t outside the loop
it's a programmer's mistake (icc might vectorize it but the
results are undefined due to the dependency), but here I don't
think it is. The t array is supposed to be a loop-private variable,
and each parallel iteration refer to their own isolated instance.


More information about the llvm-dev mailing list