------- Comment #3 from changpeng dot fang at amd dot com  2010-05-07 21:33 
-------
I just found that the test case in the same as (similar to) bug 35229.
The subject of this bug is wrong. Scalar expansion is not appropriate
for this case.

Actually the loop can be transform to:

void foo(int n)
{
  int i;
  a[0] = b[0]; /* + t if t live before this point */
  for(i=1; i<n; i++)
    {
      a[i] = b[i] + b[i-1]; 
    }
  /* t = b[n-1]; is t live after this point */
}

The this loop can be vectorized.

In open64, this optimization is called forward (backward) substitution, i.e.
substitute t with b[i-1].

I am not clear whether bug 35229 addresses the same issue. Maybe we should
close
one of them.


-- 

changpeng dot fang at amd dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|enhance scalar expansion to |gcc should vectorize this
                   |vectorize this loop         |loop by substitution


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

Reply via email to