1 /* { dg-do compile } */
2 /* { dg-options "-O3 -fno-ipa-sra -fdump-ipa-cp-details -fdump-tree-optimized-slim" } */
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(struct S * p)13 foo (struct S *p)
14 {
15 int i, c = p->c;
16 int b = p->b;
17 void *v = (void *) p;
18
19 for (i= 0; i< c; i++)
20 v = blah(b + i, v);
21 }
22
23 void
entry(int c)24 entry (int c)
25 {
26 struct S s;
27 int i;
28
29 for (i = 0; i<c; i++)
30 {
31 s.a = 1;
32 s.b = 64;
33 s.c = 32;
34 foo (&s);
35 }
36 s.c = 2;
37 foo (&s);
38 }
39 /* { dg-final { scan-ipa-dump-times "Creating a specialized node of foo/\[0-9\]*\\." 2 "cp" } } */
40 /* { dg-final { scan-ipa-dump-times "Aggregate replacements:" 4 "cp" } } */
41 /* { dg-final { cleanup-ipa-dump "cp" } } */
42 /* { dg-final { scan-tree-dump-not "->c;" "optimized" } } */
43 /* { dg-final { cleanup-tree-dump "optimized" } } */
44