This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/43543] New: Reorder the statements in the loop can vectorize it
- From: "changpeng dot fang at amd dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Mar 2010 17:58:53 -0000
- Subject: [Bug tree-optimization/43543] New: Reorder the statements in the loop can vectorize it
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
int a[100], b[100], c[100], d[100];
void foo ()
{
int i;
for(i=1; i< 99; i++)
{
a[i] = b[i-1] + c[i];
b[i] = b[i+1] + d[i];
}
}
gcc -O3 -ffast-math -ftree-vectorizer-verbose=2 -c foo.c
foo.c:6: note: not vectorized, possible dependence between data-refs
b[D.2728_3] and b[i_17]
foo.c:3: note: vectorized 0 loops in function.
However, if we reorder the two statements in the loop, then it can be
vectorized. open64 can do this reordering.
--
Summary: Reorder the statements in the loop can vectorize it
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: changpeng dot fang at amd dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43543