// David Li
Gcc's scalar replacement and predictive commoning implementation is very good.
There are some missing cases. Handling output dependence is one of them.

Handling of output dependence. In this case, the store at (1) is dead except
for the last iteration -- it should be sinked out of the loop. (-O3
-fno-tree-vectorize)

int a[1000];
int b[1000];

void foo(int n)
{
   int i = 1;
   for(; i < n; i++)
   {
        a[i+1] =i;     // (1) 
        a[i] = i+1;
   }
}


-- 
           Summary: Scalar replacement to handle output dependence
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: xinliangli at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35345

Reply via email to