2013-10-21 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / ipa / ipcp-agg-5.c
blob9f6ee5beea1d99948d94d87aa57f0c82b3c8858f
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 } */
5 struct S
7 int a, b, c;
8 };
10 void *blah(int, void *);
12 static void __attribute__ ((noinline))
13 foo (struct S *p)
15 int i, c = p->c;
16 int b = p->b;
17 void *v = (void *) p;
19 for (i= 0; i< c; i++)
20 v = blah(b + i, v);
23 static void __attribute__ ((noinline))
24 bar (struct S *p)
26 foo (p);
29 void
30 entry1 (int c)
32 struct S s;
33 int i;
35 for (i = 0; i<c; i++)
37 s.a = 1;
38 s.b = 64;
39 s.c = 32;
40 bar (&s);
42 s.c = 2;
43 bar (&s);
46 void
47 entry2 (int c)
49 struct S s;
50 int i;
52 for (i = 0; i<c; i++)
54 s.a = 6;
55 s.b = 64;
56 s.c = 32;
57 foo (&s);
59 s.c = 2;
60 foo (&s);
63 /* { dg-final { scan-ipa-dump-times "Creating a specialized node of foo/\[0-9\]*\\." 2 "cp" } } */
64 /* { dg-final { scan-ipa-dump-times "Creating a specialized node of bar/\[0-9\]*\\." 2 "cp" } } */
65 /* { dg-final { scan-ipa-dump-times "Aggregate replacements:" 8 "cp" } } */
66 /* { dg-final { cleanup-ipa-dump "cp" } } */
67 /* { dg-final { scan-tree-dump-not "->c;" "optimized" } } */
68 /* { dg-final { cleanup-tree-dump "optimized" } } */