Commit fc6f94f5 by Eric Botcazou

tree-ssa-alias.c (nonoverlapping_component_refs_of_decl_p): New.

	* tree-ssa-alias.c (nonoverlapping_component_refs_of_decl_p): New.
	(decl_refs_may_alias_p): Add REF1 and REF2 parameters.
	Use nonoverlapping_component_refs_of_decl_p to disambiguate component
	references.
	(refs_may_alias_p_1): Adjust call to decl_refs_may_alias_p.
	* tree-streamer.c (record_common_node): Adjust reference in comment.

From-SVN: r198024
parent 070edbc2
2013-04-17 Eric Botcazou <ebotcazou@adacore.com>
* tree-ssa-alias.c (nonoverlapping_component_refs_of_decl_p): New.
(decl_refs_may_alias_p): Add REF1 and REF2 parameters.
Use nonoverlapping_component_refs_of_decl_p to disambiguate component
references.
(refs_may_alias_p_1): Adjust call to decl_refs_may_alias_p.
* tree-streamer.c (record_common_node): Adjust reference in comment.
2013-04-17 Terry Guo <terry.guo@arm.com> 2013-04-17 Terry Guo <terry.guo@arm.com>
* config/arm/cortex-m4.md: Add a new bypass. * config/arm/cortex-m4.md: Add a new bypass.
......
2013-04-17 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/discr41.ad[sb]: New test.
* gcc.dg/tree-ssa/ssa-fre-38.c: Likewise.
* gcc.dg/vect/slp-24-big-array.c: Beef up anti-vectorization trick.
* gcc.dg/vect/slp-24.c: Likewise.
* gcc.dg/vect/vect-strided-a-mult.c: Likewise.
* gcc.dg/vect/vect-strided-a-u16-i2.c: Likewise.
* gcc.dg/vect/vect-strided-a-u16-i4.c: Likewise.
* gcc.dg/vect/vect-strided-a-u16-mult.c: Likewise.
* gcc.dg/vect/vect-strided-a-u8-i2-gap.c: Likewise.
* gcc.dg/vect/vect-strided-a-u8-i8-gap2-big-array.c: Likewise.
* gcc.dg/vect/vect-strided-a-u8-i8-gap2.c: Likewise.
* gcc.dg/vect/vect-strided-a-u8-i8-gap7-big-array.c: Likewise.
* gcc.dg/vect/vect-strided-a-u8-i8-gap7.c: Likewise.
* gcc.dg/vect/vect-strided-mult-char-ls.c: Likewise.
* gcc.dg/vect/vect-strided-mult.c: Likewise.
* gcc.dg/vect/vect-strided-same-dr.c: Likewise.
* gcc.dg/vect/vect-strided-u16-i2.c: Likewise.
* gcc.dg/vect/vect-strided-u16-i4.c: Likewise.
* gcc.dg/vect/vect-strided-u32-i4.c: Likewise.
* gcc.dg/vect/vect-strided-u32-i8.c: Likewise.
* gcc.dg/vect/vect-strided-u8-i2-gap.c: Likewise.
* gcc.dg/vect/vect-strided-u8-i2.c: Likewise.
* gcc.dg/vect/vect-strided-u8-i8-gap2-big-array.c: Likewise.
* gcc.dg/vect/vect-strided-u8-i8-gap2.c: Likewise.
* gcc.dg/vect/vect-strided-u8-i8-gap4-big-array.c: Likewise.
* gcc.dg/vect/vect-strided-u8-i8-gap4-unknown.c: Likewise.
* gcc.dg/vect/vect-strided-u8-i8-gap4.c: Likewise.
* gcc.dg/vect/vect-strided-u8-i8-gap7-big-array.c: Likewise.
* gcc.dg/vect/vect-strided-u8-i8-gap7.c: Likewise.
* gcc.dg/vect/vect-strided-u8-i8.c: Likewise.
2013-04-17 Janne Blomqvist <jb@gcc.gnu.org> 2013-04-17 Janne Blomqvist <jb@gcc.gnu.org>
PR fortran/40958 PR fortran/40958
* lib/gcc-dg.exp (scan-module): Uncompress module file before * lib/gcc-dg.exp (scan-module): Uncompress module file before scanning.
scanning. * gfortran.dg/module_md5_1.f90: Remove.
* gfortran.dg/module_md5_1.f90: Remove.
2013-04-16 Naveen H.S <Naveen.Hurugalawadi@caviumnetworks.com> 2013-04-16 Naveen H.S <Naveen.Hurugalawadi@caviumnetworks.com>
......
/* { dg-do compile } */
/* { dg-options "-O -fdump-tree-fre1" } */
struct S { int i; int j; };
struct U
{
struct S a[10];
} u;
int foo (int n, int i, int j)
{
u.a[n].i = i;
u.a[n].j = j;
return u.a[n].i;
}
/* We should remove the redundant load. */
/* { dg-final { scan-tree-dump-not "= u.a\\\[n_2\\(D\\)\\\].i" "fre1" } } */
/* { dg-final { cleanup-tree-dump "fre1" } } */
...@@ -84,8 +84,8 @@ int main (void) ...@@ -84,8 +84,8 @@ int main (void)
arr[i].b = i * 2 + 10; arr[i].b = i * 2 + 10;
arr[i].c = 17; arr[i].c = 17;
arr[i].d = i+34; arr[i].d = i+34;
if (arr[i].a == 178) if (y) /* Avoid vectorization. */
abort (); abort ();
} }
check_vect (); check_vect ();
......
...@@ -16,6 +16,8 @@ typedef struct { ...@@ -16,6 +16,8 @@ typedef struct {
unsigned char ub[N*2] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; unsigned char ub[N*2] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
unsigned char uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; unsigned char uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
volatile int y = 0;
void void
main1 (unsigned char x, unsigned char max_result, unsigned char min_result, s *arr) main1 (unsigned char x, unsigned char max_result, unsigned char min_result, s *arr)
{ {
...@@ -67,8 +69,8 @@ int main (void) ...@@ -67,8 +69,8 @@ int main (void)
arr[i].b = i * 2 + 10; arr[i].b = i * 2 + 10;
arr[i].c = 17; arr[i].c = 17;
arr[i].d = i+34; arr[i].d = i+34;
if (arr[i].a == 178) if (y) /* Avoid vectorization. */
abort(); abort ();
} }
check_vect (); check_vect ();
......
...@@ -15,6 +15,8 @@ typedef struct { ...@@ -15,6 +15,8 @@ typedef struct {
unsigned int b; unsigned int b;
} ii; } ii;
volatile int y = 0;
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 () main1 ()
{ {
...@@ -32,8 +34,8 @@ main1 () ...@@ -32,8 +34,8 @@ main1 ()
arr[i].b = i * 2; arr[i].b = i * 2;
iarr[i].a = i; iarr[i].a = i;
iarr[i].b = i * 3; iarr[i].b = i * 3;
if (arr[i].a == 178) if (y) /* Avoid vectorization. */
abort(); abort ();
} }
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
......
...@@ -10,6 +10,8 @@ typedef struct { ...@@ -10,6 +10,8 @@ typedef struct {
unsigned short b; unsigned short b;
} s; } s;
volatile int y = 0;
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 () main1 ()
{ {
...@@ -22,8 +24,8 @@ main1 () ...@@ -22,8 +24,8 @@ main1 ()
{ {
arr[i].a = i; arr[i].a = i;
arr[i].b = i * 2; arr[i].b = i * 2;
if (arr[i].a == 178) if (y) /* Avoid vectorization. */
abort(); abort ();
} }
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
......
...@@ -12,6 +12,8 @@ typedef struct { ...@@ -12,6 +12,8 @@ typedef struct {
unsigned short d; unsigned short d;
} s; } s;
volatile int y = 0;
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 () main1 ()
{ {
...@@ -27,8 +29,8 @@ main1 () ...@@ -27,8 +29,8 @@ main1 ()
arr[i].b = i * 2; arr[i].b = i * 2;
arr[i].c = 17; arr[i].c = 17;
arr[i].d = i+34; arr[i].d = i+34;
if (arr[i].a == 178) if (y) /* Avoid vectorization. */
abort(); abort ();
} }
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
......
...@@ -10,6 +10,8 @@ typedef struct { ...@@ -10,6 +10,8 @@ typedef struct {
unsigned short b; unsigned short b;
} s; } s;
volatile int y = 0;
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 () main1 ()
{ {
...@@ -26,8 +28,8 @@ main1 () ...@@ -26,8 +28,8 @@ main1 ()
arr[i].a = i; arr[i].a = i;
arr[i].b = i * 2; arr[i].b = i * 2;
iarr[i] = i * 3; iarr[i] = i * 3;
if (arr[i].a == 178) if (y) /* Avoid vectorization. */
abort(); abort ();
} }
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
......
...@@ -10,6 +10,8 @@ typedef struct { ...@@ -10,6 +10,8 @@ typedef struct {
unsigned char b; unsigned char b;
} s; } s;
volatile int y = 0;
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 () main1 ()
{ {
...@@ -22,8 +24,8 @@ main1 () ...@@ -22,8 +24,8 @@ main1 ()
{ {
arr[i].a = i; arr[i].a = i;
arr[i].b = i * 2; arr[i].b = i * 2;
if (arr[i].a == 178) if (y) /* Avoid vectorization. */
abort(); abort ();
} }
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
......
...@@ -16,6 +16,8 @@ typedef struct { ...@@ -16,6 +16,8 @@ typedef struct {
unsigned char h; unsigned char h;
} s; } s;
volatile int y = 0;
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 () main1 ()
{ {
...@@ -45,8 +47,8 @@ main1 () ...@@ -45,8 +47,8 @@ main1 ()
check_res[i].h = arr[i].f; check_res[i].h = arr[i].f;
check_res[i].g = arr[i].f - arr[i].a; check_res[i].g = arr[i].f - arr[i].a;
if (arr[i].a == 178) if (y) /* Avoid vectorization. */
abort (); abort ();
} }
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
......
...@@ -16,6 +16,8 @@ typedef struct { ...@@ -16,6 +16,8 @@ typedef struct {
unsigned char h; unsigned char h;
} s; } s;
volatile int y = 0;
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 () main1 ()
{ {
...@@ -34,8 +36,8 @@ main1 () ...@@ -34,8 +36,8 @@ main1 ()
arr[i].f = i * 2 + 2; arr[i].f = i * 2 + 2;
arr[i].g = i - 3; arr[i].g = i - 3;
arr[i].h = 56; arr[i].h = 56;
if (arr[i].a == 178) if (y) /* Avoid vectorization. */
abort(); abort ();
} }
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
......
...@@ -16,6 +16,8 @@ typedef struct { ...@@ -16,6 +16,8 @@ typedef struct {
unsigned char h; unsigned char h;
} s; } s;
volatile int y = 0;
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 () main1 ()
{ {
...@@ -50,8 +52,8 @@ main1 () ...@@ -50,8 +52,8 @@ main1 ()
check_res[i].h = arr[i].d; check_res[i].h = arr[i].d;
check_res[i].g = u + t; check_res[i].g = u + t;
if (arr[i].a == 178) if (y) /* Avoid vectorization. */
abort (); abort ();
} }
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
......
...@@ -16,6 +16,8 @@ typedef struct { ...@@ -16,6 +16,8 @@ typedef struct {
unsigned char h; unsigned char h;
} s; } s;
volatile int y = 0;
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 () main1 ()
{ {
...@@ -35,8 +37,8 @@ main1 () ...@@ -35,8 +37,8 @@ main1 ()
arr[i].f = i * 5; arr[i].f = i * 5;
arr[i].g = i - 3; arr[i].g = i - 3;
arr[i].h = 67; arr[i].h = 67;
if (arr[i].a == 178) if (y) /* Avoid vectorization. */
abort(); abort ();
} }
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
......
...@@ -15,6 +15,8 @@ typedef struct { ...@@ -15,6 +15,8 @@ typedef struct {
unsigned int b; unsigned int b;
} ii; } ii;
volatile int y = 0;
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 (s *arr, ii *iarr) main1 (s *arr, ii *iarr)
{ {
...@@ -62,8 +64,8 @@ int main (void) ...@@ -62,8 +64,8 @@ int main (void)
arr[i].b = i * 2; arr[i].b = i * 2;
iarr[i].a = i; iarr[i].a = i;
iarr[i].b = i * 3; iarr[i].b = i * 3;
if (arr[i].a == 178) if (y) /* Avoid vectorization. */
abort(); abort ();
} }
main1 (arr, iarr); main1 (arr, iarr);
......
...@@ -15,6 +15,8 @@ typedef struct { ...@@ -15,6 +15,8 @@ typedef struct {
unsigned int b; unsigned int b;
} ii; } ii;
volatile int y = 0;
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 (s *arr, ii *iarr) main1 (s *arr, ii *iarr)
{ {
...@@ -62,8 +64,8 @@ int main (void) ...@@ -62,8 +64,8 @@ int main (void)
arr[i].b = i * 2; arr[i].b = i * 2;
iarr[i].a = i; iarr[i].a = i;
iarr[i].b = i * 3; iarr[i].b = i * 3;
if (arr[i].a == 178) if (y) /* Avoid vectorization. */
abort(); abort ();
} }
main1 (arr, iarr); main1 (arr, iarr);
......
...@@ -12,6 +12,8 @@ typedef struct { ...@@ -12,6 +12,8 @@ typedef struct {
s buffer1[N], buffer2[N]; s buffer1[N], buffer2[N];
volatile int y = 0;
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 (s * __restrict__ pIn, s* __restrict__ pOut) main1 (s * __restrict__ pIn, s* __restrict__ pOut)
{ {
...@@ -61,8 +63,8 @@ int main (void) ...@@ -61,8 +63,8 @@ int main (void)
buffer1[i].b = i + 8; buffer1[i].b = i + 8;
buffer2[i].a = i * 3; buffer2[i].a = i * 3;
buffer2[i].b = i * 2; buffer2[i].b = i * 2;
if (buffer1[i].a == 500) if (y) /* Avoid vectorization. */
abort(); abort ();
} }
check_vect (); check_vect ();
......
...@@ -10,6 +10,8 @@ typedef struct { ...@@ -10,6 +10,8 @@ typedef struct {
unsigned short b; unsigned short b;
} s; } s;
volatile int y = 0;
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 (s *arr) main1 (s *arr)
{ {
...@@ -46,8 +48,8 @@ int main (void) ...@@ -46,8 +48,8 @@ int main (void)
{ {
arr[i].a = i; arr[i].a = i;
arr[i].b = i * 2; arr[i].b = i * 2;
if (arr[i].a == 178) if (y) /* Avoid vectorization. */
abort(); abort ();
} }
main1 (arr); main1 (arr);
......
...@@ -12,6 +12,8 @@ typedef struct { ...@@ -12,6 +12,8 @@ typedef struct {
unsigned short d; unsigned short d;
} s; } s;
volatile int y = 0;
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 (s *arr) main1 (s *arr)
{ {
...@@ -59,8 +61,8 @@ int main (void) ...@@ -59,8 +61,8 @@ int main (void)
arr[i].b = i * 2; arr[i].b = i * 2;
arr[i].c = 17; arr[i].c = 17;
arr[i].d = i+34; arr[i].d = i+34;
if (arr[i].a == 178) if (y) /* Avoid vectorization. */
abort(); abort ();
} }
main1 (arr); main1 (arr);
......
...@@ -12,6 +12,8 @@ typedef struct { ...@@ -12,6 +12,8 @@ typedef struct {
int d; int d;
} s; } s;
volatile int y = 0;
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 (s *arr) main1 (s *arr)
{ {
...@@ -54,8 +56,8 @@ int main (void) ...@@ -54,8 +56,8 @@ int main (void)
arr[i].b = i * 2; arr[i].b = i * 2;
arr[i].c = 17; arr[i].c = 17;
arr[i].d = i+34; arr[i].d = i+34;
if (arr[i].a == 178) if (y) /* Avoid vectorization. */
abort(); abort ();
} }
main1 (arr); main1 (arr);
......
...@@ -16,6 +16,8 @@ typedef struct { ...@@ -16,6 +16,8 @@ typedef struct {
int h; int h;
} s; } s;
volatile int y = 0;
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 (s *arr) main1 (s *arr)
{ {
...@@ -68,8 +70,8 @@ int main (void) ...@@ -68,8 +70,8 @@ int main (void)
arr[i].f = i * 5; arr[i].f = i * 5;
arr[i].g = i - 3; arr[i].g = i - 3;
arr[i].h = 56; arr[i].h = 56;
if (arr[i].a == 178) if (y) /* Avoid vectorization. */
abort(); abort ();
} }
main1 (arr); main1 (arr);
......
...@@ -10,6 +10,8 @@ typedef struct { ...@@ -10,6 +10,8 @@ typedef struct {
unsigned char b; unsigned char b;
} s; } s;
volatile int y = 0;
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 (s *arr) main1 (s *arr)
{ {
...@@ -62,8 +64,8 @@ int main (void) ...@@ -62,8 +64,8 @@ int main (void)
{ {
arr[i].a = i; arr[i].a = i;
arr[i].b = i * 2; arr[i].b = i * 2;
if (arr[i].a == 178) if (y) /* Avoid vectorization. */
abort(); abort ();
} }
main1 (arr); main1 (arr);
......
...@@ -10,6 +10,8 @@ typedef struct { ...@@ -10,6 +10,8 @@ typedef struct {
unsigned char b; unsigned char b;
} s; } s;
volatile int y = 0;
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 (s *arr) main1 (s *arr)
{ {
...@@ -45,8 +47,8 @@ int main (void) ...@@ -45,8 +47,8 @@ int main (void)
{ {
arr[i].a = i; arr[i].a = i;
arr[i].b = i * 2; arr[i].b = i * 2;
if (arr[i].a == 178) if (y) /* Avoid vectorization. */
abort(); abort ();
} }
main1 (arr); main1 (arr);
......
...@@ -18,6 +18,8 @@ typedef struct { ...@@ -18,6 +18,8 @@ typedef struct {
s check_res[N]; s check_res[N];
volatile int y = 0;
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 (s *arr) main1 (s *arr)
{ {
...@@ -80,8 +82,9 @@ int main (void) ...@@ -80,8 +82,9 @@ int main (void)
check_res[i].e = arr[i].f - arr[i].b; check_res[i].e = arr[i].f - arr[i].b;
check_res[i].h = arr[i].f; check_res[i].h = arr[i].f;
check_res[i].g = arr[i].f - arr[i].b; check_res[i].g = arr[i].f - arr[i].b;
if (arr[i].a == 178)
abort (); if (y) /* Avoid vectorization. */
abort ();
} }
main1 (arr); main1 (arr);
......
...@@ -16,6 +16,8 @@ typedef struct { ...@@ -16,6 +16,8 @@ typedef struct {
unsigned char h; unsigned char h;
} s; } s;
volatile int y = 0;
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 (s *arr) main1 (s *arr)
{ {
...@@ -69,8 +71,8 @@ int main (void) ...@@ -69,8 +71,8 @@ int main (void)
arr[i].f = i * 2 + 2; arr[i].f = i * 2 + 2;
arr[i].g = i - 3; arr[i].g = i - 3;
arr[i].h = 56; arr[i].h = 56;
if (arr[i].a == 178) if (y) /* Avoid vectorization. */
abort(); abort ();
} }
main1 (arr); main1 (arr);
......
...@@ -18,6 +18,8 @@ typedef struct { ...@@ -18,6 +18,8 @@ typedef struct {
s check_res[N]; s check_res[N];
volatile int y = 0;
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 (s *arr) main1 (s *arr)
{ {
...@@ -103,8 +105,8 @@ int main (void) ...@@ -103,8 +105,8 @@ int main (void)
check_res[i].h = arr[i].c; check_res[i].h = arr[i].c;
check_res[i].g = arr[i].b + arr[i].c; check_res[i].g = arr[i].b + arr[i].c;
if (arr[i].a == 178) if (y) /* Avoid vectorization. */
abort (); abort ();
} }
main1 (arr); main1 (arr);
......
...@@ -17,6 +17,8 @@ typedef struct { ...@@ -17,6 +17,8 @@ typedef struct {
unsigned char h; unsigned char h;
} s; } s;
volatile int y = 0;
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 (s *arr, int n) main1 (s *arr, int n)
{ {
...@@ -102,8 +104,8 @@ int main (void) ...@@ -102,8 +104,8 @@ int main (void)
arr[i].f = 16; arr[i].f = 16;
arr[i].g = 3; arr[i].g = 3;
arr[i].h = 56; arr[i].h = 56;
if (arr[i].a == 178) if (y) /* Avoid vectorization. */
abort(); abort ();
} }
main1 (arr, N-2); main1 (arr, N-2);
......
...@@ -16,6 +16,8 @@ typedef struct { ...@@ -16,6 +16,8 @@ typedef struct {
unsigned char h; unsigned char h;
} s; } s;
volatile int y = 0;
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 (s *arr) main1 (s *arr)
{ {
...@@ -89,8 +91,8 @@ int main (void) ...@@ -89,8 +91,8 @@ int main (void)
arr[i].f = i * 5; arr[i].f = i * 5;
arr[i].g = i - 3; arr[i].g = i - 3;
arr[i].h = 56; arr[i].h = 56;
if (arr[i].a == 178) if (y) /* Avoid vectorization. */
abort(); abort ();
} }
main1 (arr); main1 (arr);
......
...@@ -18,6 +18,8 @@ typedef struct { ...@@ -18,6 +18,8 @@ typedef struct {
s check_res[N]; s check_res[N];
volatile int y = 0;
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 (s *arr) main1 (s *arr)
{ {
...@@ -91,8 +93,8 @@ int main (void) ...@@ -91,8 +93,8 @@ int main (void)
check_res[i].h = arr[i].d; check_res[i].h = arr[i].d;
check_res[i].g = u + t; check_res[i].g = u + t;
if (arr[i].a == 178) if (y) /* Avoid vectorization. */
abort (); abort ();
} }
main1 (arr); main1 (arr);
......
...@@ -16,6 +16,8 @@ typedef struct { ...@@ -16,6 +16,8 @@ typedef struct {
unsigned char h; unsigned char h;
} s; } s;
volatile int y = 0;
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 (s *arr) main1 (s *arr)
{ {
...@@ -74,8 +76,8 @@ int main (void) ...@@ -74,8 +76,8 @@ int main (void)
arr[i].f = i * 5; arr[i].f = i * 5;
arr[i].g = i - 3; arr[i].g = i - 3;
arr[i].h = 67; arr[i].h = 67;
if (arr[i].a == 178) if (y) /* Avoid vectorization. */
abort(); abort ();
} }
main1 (arr); main1 (arr);
......
...@@ -16,6 +16,8 @@ typedef struct { ...@@ -16,6 +16,8 @@ typedef struct {
unsigned char h; unsigned char h;
} s; } s;
volatile int y = 0;
__attribute__ ((noinline)) int __attribute__ ((noinline)) int
main1 (s *arr) main1 (s *arr)
{ {
...@@ -76,8 +78,8 @@ int main (void) ...@@ -76,8 +78,8 @@ int main (void)
arr[i].f = i + 5; arr[i].f = i + 5;
arr[i].g = i + 3; arr[i].g = i + 3;
arr[i].h = 67; arr[i].h = 67;
if (arr[i].a == 178) if (y) /* Avoid vectorization. */
abort(); abort ();
} }
main1 (arr); main1 (arr);
......
-- { dg-do compile }
-- { dg-options "-O" }
package body Discr41 is
function F return Rec is
Ret : Rec (0);
begin
return Ret;
end;
end Discr41;
package Discr41 is
type Vector is array (Positive range <>) of Long_Float;
type Date is record
LF : Long_Float := 0.0;
end record;
type Date_Vector is array (Positive range <>) of Date;
type Rec (D : Natural) is record
B1 : Boolean := False;
DL : Date_Vector (1 .. D);
VL : Vector (1 .. D) := (others => 0.0);
B2 : Boolean := True;
end record;
function F return Rec;
end Discr41;
...@@ -719,14 +719,113 @@ aliasing_component_refs_p (tree ref1, ...@@ -719,14 +719,113 @@ aliasing_component_refs_p (tree ref1,
return false; return false;
} }
/* Return true if we can determine that component references REF1 and REF2,
that are within a common DECL, cannot overlap. */
static bool
nonoverlapping_component_refs_of_decl_p (tree ref1, tree ref2)
{
vec<tree, va_stack> component_refs1;
vec<tree, va_stack> component_refs2;
vec_stack_alloc (tree, component_refs1, 16);
vec_stack_alloc (tree, component_refs2, 16);
/* Create the stack of handled components for REF1. */
while (handled_component_p (ref1))
{
component_refs1.safe_push (ref1);
ref1 = TREE_OPERAND (ref1, 0);
}
if (TREE_CODE (ref1) == MEM_REF)
{
if (!integer_zerop (TREE_OPERAND (ref1, 1)))
goto may_overlap;
ref1 = TREE_OPERAND (TREE_OPERAND (ref1, 0), 0);
}
/* Create the stack of handled components for REF2. */
while (handled_component_p (ref2))
{
component_refs2.safe_push (ref2);
ref2 = TREE_OPERAND (ref2, 0);
}
if (TREE_CODE (ref2) == MEM_REF)
{
if (!integer_zerop (TREE_OPERAND (ref2, 1)))
goto may_overlap;
ref2 = TREE_OPERAND (TREE_OPERAND (ref2, 0), 0);
}
/* We must have the same base DECL. */
gcc_assert (ref1 == ref2);
/* Pop the stacks in parallel and examine the COMPONENT_REFs of the same
rank. This is sufficient because we start from the same DECL and you
cannot reference several fields at a time with COMPONENT_REFs (unlike
with ARRAY_RANGE_REFs for arrays) so you always need the same number
of them to access a sub-component, unless you're in a union, in which
case the return value will precisely be false. */
while (true)
{
do
{
if (component_refs1.is_empty ())
goto may_overlap;
ref1 = component_refs1.pop ();
}
while (!RECORD_OR_UNION_TYPE_P (TREE_TYPE (TREE_OPERAND (ref1, 0))));
do
{
if (component_refs2.is_empty ())
goto may_overlap;
ref2 = component_refs2.pop ();
}
while (!RECORD_OR_UNION_TYPE_P (TREE_TYPE (TREE_OPERAND (ref2, 0))));
/* Beware of BIT_FIELD_REF. */
if (TREE_CODE (ref1) != COMPONENT_REF
|| TREE_CODE (ref2) != COMPONENT_REF)
goto may_overlap;
tree field1 = TREE_OPERAND (ref1, 1);
tree field2 = TREE_OPERAND (ref2, 1);
/* ??? We cannot simply use the type of operand #0 of the refs here
as the Fortran compiler smuggles type punning into COMPONENT_REFs
for common blocks instead of using unions like everyone else. */
tree type1 = TYPE_MAIN_VARIANT (DECL_CONTEXT (field1));
tree type2 = TYPE_MAIN_VARIANT (DECL_CONTEXT (field2));
/* We cannot disambiguate fields in a union or qualified union. */
if (type1 != type2 || TREE_CODE (type1) != RECORD_TYPE)
goto may_overlap;
/* Different fields of the same record type cannot overlap. */
if (field1 != field2)
{
component_refs1.release ();
component_refs2.release ();
return true;
}
}
may_overlap:
component_refs1.release ();
component_refs2.release ();
return false;
}
/* Return true if two memory references based on the variables BASE1 /* Return true if two memory references based on the variables BASE1
and BASE2 constrained to [OFFSET1, OFFSET1 + MAX_SIZE1) and and BASE2 constrained to [OFFSET1, OFFSET1 + MAX_SIZE1) and
[OFFSET2, OFFSET2 + MAX_SIZE2) may alias. */ [OFFSET2, OFFSET2 + MAX_SIZE2) may alias. REF1 and REF2
if non-NULL are the complete memory reference trees. */
static bool static bool
decl_refs_may_alias_p (tree base1, decl_refs_may_alias_p (tree ref1, tree base1,
HOST_WIDE_INT offset1, HOST_WIDE_INT max_size1, HOST_WIDE_INT offset1, HOST_WIDE_INT max_size1,
tree base2, tree ref2, tree base2,
HOST_WIDE_INT offset2, HOST_WIDE_INT max_size2) HOST_WIDE_INT offset2, HOST_WIDE_INT max_size2)
{ {
gcc_checking_assert (DECL_P (base1) && DECL_P (base2)); gcc_checking_assert (DECL_P (base1) && DECL_P (base2));
...@@ -737,7 +836,17 @@ decl_refs_may_alias_p (tree base1, ...@@ -737,7 +836,17 @@ decl_refs_may_alias_p (tree base1,
/* If both references are based on the same variable, they cannot alias if /* If both references are based on the same variable, they cannot alias if
the accesses do not overlap. */ the accesses do not overlap. */
return ranges_overlap_p (offset1, max_size1, offset2, max_size2); if (!ranges_overlap_p (offset1, max_size1, offset2, max_size2))
return false;
/* For components with variable position, the above test isn't sufficient,
so we disambiguate component references manually. */
if (ref1 && ref2
&& handled_component_p (ref1) && handled_component_p (ref2)
&& nonoverlapping_component_refs_of_decl_p (ref1, ref2))
return false;
return true;
} }
/* Return true if an indirect reference based on *PTR1 constrained /* Return true if an indirect reference based on *PTR1 constrained
...@@ -1086,8 +1195,8 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) ...@@ -1086,8 +1195,8 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p)
var1_p = DECL_P (base1); var1_p = DECL_P (base1);
var2_p = DECL_P (base2); var2_p = DECL_P (base2);
if (var1_p && var2_p) if (var1_p && var2_p)
return decl_refs_may_alias_p (base1, offset1, max_size1, return decl_refs_may_alias_p (ref1->ref, base1, offset1, max_size1,
base2, offset2, max_size2); ref2->ref, base2, offset2, max_size2);
ind1_p = (TREE_CODE (base1) == MEM_REF ind1_p = (TREE_CODE (base1) == MEM_REF
|| TREE_CODE (base1) == TARGET_MEM_REF); || TREE_CODE (base1) == TARGET_MEM_REF);
......
...@@ -267,10 +267,10 @@ record_common_node (struct streamer_tree_cache_d *cache, tree node) ...@@ -267,10 +267,10 @@ record_common_node (struct streamer_tree_cache_d *cache, tree node)
/* The FIELD_DECLs of structures should be shared, so that every /* The FIELD_DECLs of structures should be shared, so that every
COMPONENT_REF uses the same tree node when referencing a field. COMPONENT_REF uses the same tree node when referencing a field.
Pointer equality between FIELD_DECLs is used by the alias Pointer equality between FIELD_DECLs is used by the alias
machinery to compute overlapping memory references (See machinery to compute overlapping component references (see
nonoverlapping_component_refs_p). */ nonoverlapping_component_refs_p and
tree f; nonoverlapping_component_refs_of_decl_p). */
for (f = TYPE_FIELDS (node); f; f = TREE_CHAIN (f)) for (tree f = TYPE_FIELDS (node); f; f = TREE_CHAIN (f))
record_common_node (cache, f); record_common_node (cache, f);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment