OSDN Git Service

2008-08-21 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / tree-ssa / ssa-fre-14.c
1 /* { dg-do compile } */
2 /* { dg-options "-O -fno-tree-sra --param max-aliased-vops=0 --param max-fields-for-field-sensitive=0 -fdump-tree-fre-details" } */
3
4 /* Should be optimized, propagating &a into (*p)[i] with parameters
5      --param max-aliased-vops=0 --param max-fields-for-field-sensitive=0
6    which means max 1 VOP per stmt and no SFTs.  */
7
8 struct Foo
9 {
10   void *data;
11   double size;
12 };
13 void foo(double (*q)[4])
14 {
15   struct Foo tmp1;
16   double a[4];
17   int i;
18   tmp1.data = &a;
19   tmp1.size = 4;
20   for (i=0; i<4; ++i)
21     {
22       double (*p)[4] = tmp1.data;
23       (*p)[i] = (*q)[i];
24       /* We want a PHI for the VOP for accessing tmp1.data, so place
25          this store to tmp1 here.  */
26       tmp1.size -= 1.0;
27     }
28 }
29
30 /* { dg-final { scan-tree-dump "Inserted .* &a" "fre" } } */
31 /* { dg-final { scan-tree-dump "Replaced tmp1.data" "fre" } } */
32 /* { dg-final { cleanup-tree-dump "fre" } } */