https://bugs.llvm.org/show_bug.cgi?id=38049
Bug ID: 38049
Summary: Loop vectorization: __restrict__ ignored ?
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Loop Optimizer
Assignee: unassignedb...@nondot.org
Reporter: m-takah...@jp.fujitsu.com
CC: llvm-bugs@lists.llvm.org
The following loop is not vectorized despite of using restrict specifier.
-----------------
extern double **xx1, **yy1, **zz1;
void foo_ng(const int M, const int N) {
double (* __restrict__ x1)[M] = (double(*)[M]) xx1;
double (* __restrict__ y1)[M] = (double(*)[M]) yy1;
double (* __restrict__ z1)[M] = (double(*)[M]) zz1;
for (int i = 0; i < N; ++i) {
x1[0][i] = y1[0][i] + z1[0][i];
x1[1][i] = y1[1][i] + z1[1][i];
}
}
-----------------
$ clang --version
clang version 7.0.0 (trunk 336237)
$ clang -Ofast -Rpass=loop-vectorize test.c -Rpass-analysis=
loop-vectorize
test.c:8:3: remark: loop not vectorized: cannot prove it is safe to reorder
memory
operations; allow reordering by specifying '#pragma clang loop
vectorize(enable)'
before the loop. If the arrays will always be independent specify
'#pragma clang
loop vectorize(assume_safety)' before the loop or provide the
'__restrict__'
qualifier with the independent array arguments. Erroneous results will
occur if
these options are incorrectly applied! [-Rpass-analysis=loop-vectorize]
for (int i = 0; i < N; ++i) {
I added '#pragma clang loop vectorize(enable)' as the analysis message shows,
and the loop was vectorized. But, '__restrict__' is specified to the original
loop. So, I think it can be vectorized without pragma, but it wasn't
vectorized.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs