This patch generates a list of global external variables that are
passed to the llvm::TargetLibraryInfo (TLI) to enable the vectorization of
loops containing calls to function that are marked with a #pragma omp
declare simd.
To do so, the global variables are generated as "global external", so
that they get removed in the middle-end and generated no useless code.
A new method of the TLI (provided in a separate LLVM patch) looks for
such global variables and updates the lists of vectorizable functions
that the vectorizer can use.
This behavior enables the programmer to provide vector routines that
are recognized as vectorizable by using the OpenMP directive "declare
simd" as follow:
$> clang -fopenmp -c -o whatever.o -O3 file.c
where file.c is
#pragma omp declare simd double f(double x); void aaa(double *x, double *y, int N) { for (int i = 0; i < N; ++i) { x[i] = f(y[i]); } }
Stray space