Debian Codegraph @

gcc/testsuite/gcc.dg/ipa/ipcp-agg-8.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O3 -fno-ipa-sra -fdump-ipa-cp" } */
3 /* { dg-add-options bind_pic_locally } */
4
5 struct S
6 {
7 int a, b, c;
8 };
9
10 void *blah(int, void *);
11
12 static void __attribute__ ((noinline)) foo (int x, int z, struct S *p);
13
14 static void __attribute__ ((noinline))
15 bar (int x, int z, struct S *p)
16 {
17 p->b = 0;
18 foo (z, x, p);
19 }
20
21 static void __attribute__ ((noinline))
22 foo (int x, int z, struct S *p)
23 {
24 int i, c = p->c;
25 int b = p->b - z;
26 void *v = (void *) p;
27
28 if (z)
29 {
30 z--;
31 bar (z, x, p);
32 }
33 for (i = 0; i< c; i++)
34 v = blah(b + x + i, v);
35 }
36
37 void
38 entry (int c)
39 {
40 struct S s;
41 int i;
42
43 for (i = 0; i<c; i++)
44 {
45 s.a = c;
46 s.b = 64;
47 s.c = 32;
48 foo (4, i, &s);
49 }
50 }
51 /* { dg-final { scan-ipa-dump "Aggregate replacements: 1\\\[4]=64\\(by_ref\\), 1\\\[8]=32\\(by_ref\\)" "cp" } } */
52 /* { dg-final { scan-ipa-dump "Aggregate replacements: 1\\\[4]=0\\(by_ref\\)" "cp" } } */