[LLVMdev] Proposal for ""llvm.mem.vectorize.safelen"

Robison, Arch
Wed, 20 Aug 2014 16:16:32 -0000

Thanks for alerting me to this issue.  This is going to take more
effort than I thought :-(.  Given that a major motivation behind
the OpenMP #pragma omp simd is to allow lexical forward dependences,
we should find a way to do this right.

I agree that we want to avoid making passes that reorder accesses fragile.
The extra work in Clang (or Julia :-) seems unavoidable, unless those
producers always emit LLVM instructions in lexical order.  If the latter
is the case, perhaps we could have a helper routine that, given the IR early
and in lexical order, finishes the annotation work?

It seems that we need metadata on each memory access, distinct from
llvm.mem.parallel_loop_access.  Say something like llvm.mem.vector_loop_access
that includes relative lexical position as a third operand?  Second operand
could point back to the metadata with the minimum loop-carried distance,
which in turn could point back to the loop id.

- Arch