Eric Botcazou <ebotca...@adacore.com> writes: > [Sorry for missing the previous messages] > >> Thanks. Just been retesting, and I think I must have forgotten >> to include Ada last time. It turns out that the patch causes a dg-scan >> regression in gnat.dg/vect17.adb, because we now think that if the >> array RECORD_TYPEs *do* alias in: >> >> procedure Add (X, Y : aliased Sarray; R : aliased out Sarray) is >> begin >> for I in Sarray'Range loop >> R(I) := X(I) + Y(I); >> end loop; >> end; >> >> then the dependence distance must be zero. Eric, does that hold true >> for Ada? I.e. if X and R (or Y and R) alias, must it be the case that >> X(I) can only alias R(I) and not for example R(I-1) or R(I+1)? > > Yes, I'd think so (even without the artificial RECORD_TYPE around the arrays).
Good! >> 2017-06-07 Richard Sandiford <richard.sandif...@linaro.org> >> >> gcc/testsuite/ >> * gnat.dg/vect17.ads (Sarray): Increase range to 1 .. 5. >> * gnat.dg/vect17.adb (Add): Create a dependence distance of 1 >> when X = R or Y = R. > > I think that you need to modify vect15 and vect16 the same way. Ah, yeah. And doing that shows that I'd not handled safelen for DDR_COULD_BE_INDEPENDENT_P. I've fixed that locally. How does this look? Tested on x86_64-linux-gnu both without the vectoriser changes and with the fixed vectoriser patch. Thanks, Richard 2017-07-07 Richard Sandiford <richard.sandif...@linaro.org> gcc/testsuite/ * gnat.dg/vect15.ads (Sarray): Increase range to 1 .. 5. * gnat.dg/vect16.ads (Sarray): Likewise. * gnat.dg/vect17.ads (Sarray): Likewise. * gnat.dg/vect15.adb (Add): Create a dependence distance of 1. * gnat.dg/vect16.adb (Add): Likewise. * gnat.dg/vect17.adb (Add): Likewise. Index: gcc/testsuite/gnat.dg/vect15.ads =================================================================== --- gcc/testsuite/gnat.dg/vect15.ads 2015-10-14 14:58:56.000000000 +0100 +++ gcc/testsuite/gnat.dg/vect15.ads 2017-07-07 13:12:51.509540701 +0100 @@ -1,6 +1,6 @@ package Vect15 is - type Sarray is array (1 .. 4) of Long_Float; + type Sarray is array (1 .. 5) of Long_Float; for Sarray'Alignment use 16; procedure Add (X, Y : Sarray; R : out Sarray); Index: gcc/testsuite/gnat.dg/vect16.ads =================================================================== --- gcc/testsuite/gnat.dg/vect16.ads 2015-10-14 14:58:56.000000000 +0100 +++ gcc/testsuite/gnat.dg/vect16.ads 2017-07-07 13:12:51.511540636 +0100 @@ -1,6 +1,6 @@ package Vect16 is - type Sarray is array (1 .. 4) of Long_Float; + type Sarray is array (1 .. 5) of Long_Float; for Sarray'Alignment use 16; procedure Add_Sub (X, Y : Sarray; R,S : out Sarray); Index: gcc/testsuite/gnat.dg/vect17.ads =================================================================== --- gcc/testsuite/gnat.dg/vect17.ads 2017-06-07 22:13:29.692531472 +0100 +++ gcc/testsuite/gnat.dg/vect17.ads 2017-07-07 13:12:51.514540538 +0100 @@ -1,6 +1,6 @@ package Vect17 is - type Sarray is array (1 .. 4) of Long_Float; + type Sarray is array (1 .. 5) of Long_Float; for Sarray'Alignment use 16; procedure Add (X, Y : aliased Sarray; R : aliased out Sarray); Index: gcc/testsuite/gnat.dg/vect15.adb =================================================================== --- gcc/testsuite/gnat.dg/vect15.adb 2015-10-14 14:58:56.000000000 +0100 +++ gcc/testsuite/gnat.dg/vect15.adb 2017-07-07 13:12:51.509540701 +0100 @@ -5,8 +5,9 @@ package body Vect15 is procedure Add (X, Y : Sarray; R : out Sarray) is begin - for I in Sarray'Range loop - R(I) := X(I) + Y(I); + R(1) := X(5) + Y(5); + for I in 1 .. 4 loop + R(I + 1) := X(I) + Y(I); end loop; end; Index: gcc/testsuite/gnat.dg/vect16.adb =================================================================== --- gcc/testsuite/gnat.dg/vect16.adb 2015-10-14 14:58:56.000000000 +0100 +++ gcc/testsuite/gnat.dg/vect16.adb 2017-07-07 13:12:51.510540669 +0100 @@ -5,9 +5,11 @@ package body Vect16 is procedure Add_Sub (X, Y : Sarray; R,S : out Sarray) is begin - for I in Sarray'Range loop - R(I) := X(I) + Y(I); - S(I) := X(I) - Y(I); + R(1) := X(5) + Y(5); + S(1) := X(5) - Y(5); + for I in 1 .. 4 loop + R(I + 1) := X(I) + Y(I); + S(I + 1) := X(I) - Y(I); end loop; end; Index: gcc/testsuite/gnat.dg/vect17.adb =================================================================== --- gcc/testsuite/gnat.dg/vect17.adb 2017-06-07 22:13:29.692531472 +0100 +++ gcc/testsuite/gnat.dg/vect17.adb 2017-07-07 13:12:51.512540603 +0100 @@ -5,8 +5,9 @@ package body Vect17 is procedure Add (X, Y : aliased Sarray; R : aliased out Sarray) is begin - for I in Sarray'Range loop - R(I) := X(I) + Y(I); + R(1) := X(5) + Y(5); + for I in 1 .. 4 loop + R(I + 1) := X(I) + Y(I); end loop; end;