PR c/56980
[official-gcc.git] / gcc / testsuite / gcc.dg / ipa / ipcp-1.c
bloba2ffd420203a93998f68cd049878f87d5817062c
1 /* Test that IPA-CP is able to figure out that poth parameters a are constant 7
2 even though f and h recursively call each other and specialize them
3 accordinly. */
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 } */
9 extern void use_stuff (int);
11 static
12 int g (int b, int c)
14 int i;
16 for (i = 0; i < b; i++)
17 use_stuff (c);
20 static void f (int a, int x, int z);
22 static void h (int z, int a)
24 use_stuff (z);
25 f (a, 9, 10);
29 static void
30 f (int a, int x, int z)
32 if (z > 1)
33 g (a, x);
34 else
35 h (5, a);
38 int
39 main (int argc, char *argv[])
41 int i;
42 for (i = 0; i < 100; i++)
43 f (7, 8, argc);
44 return 0;
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 /* { dg-final { cleanup-ipa-dump "cp" } } */