PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.dg / ipa / ipcp-agg-6.c
blobf8e5cd630f6a81dbe07aa2297471929f6b6b54b0
1 /* { dg-do compile } */
2 /* { dg-options "-O3 -fno-ipa-sra -fdump-ipa-cp-details -fdump-tree-optimized-slim -fno-ipa-icf" } */
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 static void __attribute__ ((noinline))
30 bar_2 (struct S *p)
32 foo (p);
35 void
36 entry1 (int c)
38 struct S s;
39 int i;
41 for (i = 0; i<c; i++)
43 s.a = 1;
44 s.b = 64;
45 s.c = 32;
46 bar (&s);
48 s.c = 2;
49 bar (&s);
52 void
53 entry2 (int c)
55 struct S s;
56 int i;
58 for (i = 0; i<c; i++)
60 s.a = 6;
61 s.b = 64;
62 s.c = 32;
63 bar_2 (&s);
65 s.c = 2;
66 foo (&s);
69 /* { dg-final { scan-ipa-dump-times "Creating a specialized node of foo/\[0-9\]*\\." 2 "cp" } } */
70 /* { dg-final { scan-ipa-dump-times "Creating a specialized node of bar/\[0-9\]*\\." 2 "cp" } } */
71 /* { dg-final { scan-ipa-dump "Creating a specialized node of bar_2.*for all known contexts" "cp" } } */
72 /* { dg-final { scan-ipa-dump-times "Aggregate replacements:" 10 "cp" } } */
73 /* { dg-final { scan-tree-dump-not "->c;" "optimized" } } */