2018-04-30 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / structopt-2.c
blob327b54c162c17a1895c45df125355a69d4361458
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-optimized -fno-tree-sra" } */
4 /* Even without SRA being enabled, we should be able to eliminate every structure store and load here. */
5 extern void foo (const int);
6 int main(void)
8 struct a
10 int e;
11 int f;
12 int g;
13 } a;
14 struct a b;
15 int x, c;
16 a.e = 50;
17 a.f = 9;
18 a.g = a.e * a.f;
19 foo (a.f);
20 foo (a.g);
21 x = a.f;
22 c = a.e;
23 foo (x);
24 foo (c);
25 a.e = 5;
26 a.f = 40;
27 a.g = 90;
28 foo (a.e);
29 foo (a.f);
30 foo (a.g);
31 c = a.f;
32 foo (c);
33 b.e = 9;
34 a.e = b.e + 1 * c;
35 a.f = 30;
36 foo (a.e);
37 foo (a.f);
38 x = a.e * a.f;
39 foo (x);
42 /* { dg-final { scan-tree-dump-times "a.e" 0 "optimized" } } */
43 /* { dg-final { scan-tree-dump-times "a.f" 0 "optimized" } } */
44 /* { dg-final { scan-tree-dump-times "a.g" 0 "optimized" } } */
45 /* { dg-final { scan-tree-dump-times "b.e" 0 "optimized" } } */