1 /* { dg-do compile } */
2 /* { dg-options "-O3 -fipa-cp -fipa-cp-clone -fdump-ipa-cp -fno-early-inlining -fdump-tree-optimized"  } */
3 /* { dg-add-options bind_pic_locally } */
4 
5 int array[100];
6 
7 int t(int);
8 
9 static int
i_can_be_propagated_fully(int * a)10 i_can_be_propagated_fully (int *a)
11 {
12   int i;
13   for (i=0;i<50;i++)
14   {
15     t(a[i]);
16     t(a[i+1]);
17     t(a[i+2]);
18     t(a[i+3]);
19   }
20 }
21 static int
i_can_be_propagated_fully2(int * a)22 i_can_be_propagated_fully2 (int *a)
23 {
24   i_can_be_propagated_fully (a);
25   i_can_be_propagated_fully (a);
26   i_can_be_propagated_fully (a);
27 }
28 static int
i_can_not_be_propagated_fully(int * a)29 i_can_not_be_propagated_fully (int *a)
30 {
31   int i;
32   for (i=0;i<50;i++)
33   {
34     t(a[i]);
35     t(a[i+1]);
36     t(a[i+2]);
37     t(a[i+3]);
38   }
39 }
40 int
i_can_not_be_propagated_fully2(int * a)41 i_can_not_be_propagated_fully2 (int *a)
42 {
43   int i;
44   i_can_not_be_propagated_fully (a);
45   for (i=0;i<50;i++)
46   {
47     t(a[i] + 1);
48     t(a[i+1] + 1);
49     t(a[i+2] + 1);
50     t(a[i+3] + 1);
51   }
52   i_can_not_be_propagated_fully (a);
53   for (i=0;i<50;i++)
54   {
55     t(a[i] + 2);
56     t(a[i+1] + 2);
57     t(a[i+2] + 2);
58     t(a[i+3] + 2);
59   }
60   i_can_not_be_propagated_fully (a);
61 }
main()62 main()
63 {
64   int i;
65   i_can_be_propagated_fully2 (array);
66   i_can_be_propagated_fully2 (array);
67 
68   for (i = 0; i < 7; i++)
69     i_can_not_be_propagated_fully2 (array);
70   i_can_not_be_propagated_fully2 (array);
71 }
72 
73 /* { dg-final { scan-ipa-dump-times "Creating a specialized node of i_can_be_propagated_fully2" 1 "cp"  } } */
74 /* { dg-final { scan-ipa-dump-times "Creating a specialized node of i_can_be_propagated_fully/" 1 "cp"  } } */
75 /* { dg-final { scan-ipa-dump-not "Creating a specialized node of i_can_not_be_propagated_fully2" "cp"  } } */
76 /* { dg-final { scan-ipa-dump-not "Creating a specialized node of i_can_not_be_propagated_fully/" "cp"  } } */
77 /* { dg-final { scan-tree-dump-not "i_can_be_propagated_fully \\(" "optimized"  } } */
78 /* { dg-final { scan-tree-dump-not "i_can_be_propagated_fully2 \\(" "optimized"  } } */
79 /* { dg-final { cleanup-ipa-dump "cp" } } */
80 /* { dg-final { cleanup-tree-dump "optimized" } } */
81