Michael Hope <michael.h...@linaro.org> wrote:

> int *a;
> int *b;
> int *c;
>
> const int ad[320];
> const int bd[320];
> const int cd[320];
>
> void fill()
> {
>   for (int i = 0; i < 320; i++)
>     {
>       a[i] = ad[i];
>       b[i] = bd[i];
>       c[i] = cd[i];
>     }
> }
[snip]
> Can we always use the second form?  What optimisation is preventing it?

Without having looked into this in detail, my guess would be
it depends on whether the compiler is able to prove that the
memory pointed to by a, b, and c is distinct (instead of having
a potential overlap if those are pointers into the same array).

Does it help if you make a, b, and c function arguments to fill,
and mark them restrict?


Mit freundlichen Gruessen / Best Regards

Ulrich Weigand

--
  Dr. Ulrich Weigand | Phone: +49-7031/16-3727
  STSM, GNU compiler and toolchain for Linux on System z and Cell/B.E.
  IBM Deutschland Research & Development GmbH
  Vorsitzender des Aufsichtsrats: Martin Jetter | Geschäftsführung: Dirk
Wittkopp
  Sitz der Gesellschaft: Böblingen | Registergericht: Amtsgericht
Stuttgart, HRB 243294


_______________________________________________
linaro-toolchain mailing list
linaro-toolchain@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-toolchain

Reply via email to