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.  */
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
9extern void use_stuff (int);
10
11static
12int g (int b, int c)
13{
14  int i;
15
16  for (i = 0; i < b; i++)
17    use_stuff (c);
18}
19
20static void f (int a, int x, int z);
21
22static void h (int z, int a)
23{
24  use_stuff (z);
25  f (a, 9, 10);
26
27}
28
29static void
30f (int a, int x, int z)
31{
32  if (z > 1)
33    g (a, x);
34  else
35    h (5, a);
36}
37
38int
39main (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/* { dg-final { cleanup-ipa-dump "cp" } } */
51
52
53