This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/43543] New: Reorder the statements in the loop can vectorize it


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]