Hybrid EVRP and testcases
[gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / sra-14.c
1 /* { dg-do run } */
2 /* { dg-options "-O1" } */
3
4 struct S
5 {
6 int i, j;
7 };
8
9 struct Z
10 {
11 struct S d, s;
12 };
13
14 struct S __attribute__ ((noinline, noclone))
15 get_s (void)
16 {
17 struct S s;
18 s.i = 5;
19 s.j = 6;
20
21 return s;
22 }
23
24 struct S __attribute__ ((noinline, noclone))
25 get_d (void)
26 {
27 struct S d;
28 d.i = 0;
29 d.j = 0;
30
31 return d;
32 }
33
34 int __attribute__ ((noinline, noclone))
35 get_c (void)
36 {
37 return 1;
38 }
39
40 int __attribute__ ((noinline, noclone))
41 my_nop (int i)
42 {
43 return i;
44 }
45
46 int __attribute__ ((noinline, noclone))
47 foo (void)
48 {
49 struct Z z;
50 int i, c = get_c ();
51
52 z.d = get_d ();
53 z.s = get_s ();
54
55 for (i = 0; i < c; i++)
56 {
57 z.s.i = my_nop (z.s.i);
58 z.s.j = my_nop (z.s.j);
59 }
60
61 return z.s.i + z.s.j;
62 }
63
64 int main (int argc, char *argv[])
65 {
66 if (foo () != 11)
67 __builtin_abort ();
68 return 0;
69 }
70