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 23static void __attribute__ ((noinline)) 24bar (struct S *p) 25{ 26 foo (p); 27} 28 29void 30entry1 (int c) 31{ 32 struct S s; 33 int i; 34 35 for (i = 0; i<c; i++) 36 { 37 s.a = 1; 38 s.b = 64; 39 s.c = 32; 40 bar (&s); 41 } 42 s.c = 2; 43 bar (&s); 44} 45 46void 47entry2 (int c) 48{ 49 struct S s; 50 int i; 51 52 for (i = 0; i<c; i++) 53 { 54 s.a = 6; 55 s.b = 64; 56 s.c = 32; 57 foo (&s); 58 } 59 s.c = 2; 60 foo (&s); 61} 62 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" } } */ 69