1 /* Test that IPA-CP is able to figure out that both parameters a are constant 7
2 even though f and h recursively call each other and specialize them
3 accordingly. */
4
5 /* { dg-do compile } */
6 /* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining" } */
7 /* { dg-add-options bind_pic_locally } */
8
9 extern void use_stuff (int);
10
11 static
g(int b,int c)12 int g (int b, int c)
13 {
14 int i;
15
16 for (i = 0; i < b; i++)
17 use_stuff (c);
18 }
19
20 static void f (int a, int x, int z);
21
h(int z,int a)22 static void h (int z, int a)
23 {
24 use_stuff (z);
25 f (a, 9, 10);
26
27 }
28
29 static void
f(int a,int x,int z)30 f (int a, int x, int z)
31 {
32 if (z > 1)
33 g (a, x);
34 else
35 h (5, a);
36 }
37
38 int
main(int argc,char * argv[])39 main (int argc, char *argv[])
40 {
41 int i;
42 for (i = 0; i < 100; i++)
43 f (7, 8, argc);
44 return 0;
45 }
46
47
48 /* { dg-final { scan-ipa-dump "Creating a specialized node of f.*for all known contexts" "cp" } } */
49 /* { dg-final { scan-ipa-dump "replacing param .0 a with const 7" "cp" } } */
50
51
52