------- Comment #1 from sebpop at gmail dot com  2007-11-03 06:31 -------
Subject: Re:  New: missed optimization with dependency checker

> int
> foo (char *a, unsigned n)
> {
>     int i;
>     a[0] = 0;
>     for (i = 16; i < n; i++)
>       a[i] = a[i-16];
> }
>

We're failing to analyse the base of the array 'a' for this code, as
there is a cast from "signed int" to "unsigned int" for the main iv:

  # i.0D.1181_20 = PHI <i.0D.1181_4(5), 16(3)>
  # iD.1177_19 = PHI <iD.1177_12(5), 16(3)>

  D.1182_7 = aD.1173_2(D) + i.0D.1181_20;

  iD.1177_12 = iD.1177_19 + 1;
  i.0D.1181_4 = (unsigned intD.3) iD.1177_12;
  if (i.0D.1181_4 < nD.1174_5(D))

This is due to the fact that we have to convert 'i' to unsigned before
comparing with 'n'.  The exact same testcase with just a signed type
for 'n' is vectorized:

int
foo (char *a, int n)
{
   int i;
   a[0] = 0;
   for (i = 16; i < n; i++)
     a[i] = a[i-16];
}


-- 


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

Reply via email to