1 /* { dg-do compile } */
2 /* { dg-options "-O3 -fno-ipa-sra -fdump-ipa-cp-details --param=ipa-cp-eval-threshold=2" } */
3
4 struct S
5 {
6 int a, b, c;
7 };
8
9 int __attribute__((noinline)) foo (int i, struct S s);
10 int __attribute__((noinline)) bar (int i, struct S s);
11 int __attribute__((noinline)) baz (int i, struct S s);
12
13
14 int __attribute__((noinline))
bar(int i,struct S s)15 bar (int i, struct S s)
16 {
17 return baz (i, s);
18 }
19
20 int __attribute__((noinline))
baz(int i,struct S s)21 baz (int i, struct S s)
22 {
23 return foo (i, s);
24 }
25
26 int __attribute__((noinline))
foo(int i,struct S s)27 foo (int i, struct S s)
28 {
29 if (i == 2)
30 return 0;
31 else
32 return s.b * s.b + bar (i - 1, s);
33 }
34
35 volatile int g;
36
entry(void)37 void entry (void)
38 {
39 struct S s;
40 s.b = 4;
41 g = bar (g, s);
42 }
43
44
entry2(void)45 void entry2 (void)
46 {
47 struct S s;
48 s.b = 6;
49 g = baz (g, s);
50 }
51
52
53 /* { dg-final { scan-ipa-dump-times "adding an extra caller" 2 "cp" } } */
54