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
5struct S
6{
7  int a, b, c;
8};
9
10void *blah(int, void *);
11
12static void __attribute__ ((noinline))
13foo (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
23void
24entry (void)
25{
26  struct S s;
27  s.a = 1;
28  s.b = 64;
29  s.c = 32;
30  foo (&s);
31}
32
33/* { dg-final { scan-ipa-dump "Creating a specialized node of foo.*for all known contexts" "cp" } } */
34/* { dg-final { scan-ipa-dump-times "Aggregate replacements:" 2 "cp" } } */
35/* { dg-final { cleanup-ipa-dump "cp" } } */
36/* { dg-final { scan-tree-dump-not "->c;" "optimized" } } */
37/* { dg-final { cleanup-tree-dump "optimized" } } */
38