43ca58b9ef2f7ff45ec3c2882673874d3092b3e4
[gcc.git] / gcc / testsuite / gcc.dg / struct / wo_prof_escape_arg_to_local.c
1 /* { dg-options "-O3 -fno-inline -fipa-type-escape -fdump-ipa-all -fipa-struct-reorg -fwhole-program -combine" } */
2 /* { dg-do compile } */
3 /* { dg-do run } */
4
5 #include <stdlib.h>
6 struct str
7 {
8 int a;
9 float b;
10 };
11
12 #ifdef STACK_SIZE
13 #if STACK_SIZE > 8000
14 #define N 1000
15 #else
16 #define N (STACK_SIZE/8)
17 #endif
18 #else
19 #define N 1000
20 #endif
21
22 int
23 foo (struct str * p_str)
24 {
25 static int sum = 0;
26
27 sum = sum + p_str->a;
28 return sum;
29 }
30
31 int
32 main ()
33 {
34 int i, sum;
35 struct str * p = malloc (N * sizeof (struct str));
36 if (p == NULL)
37 return 0;
38 for (i = 0; i < N; i++)
39 sum = foo (p+i);
40
41 return 0;
42 }
43
44 /*--------------------------------------------------------------------------*/
45 /* { dg-final { scan-ipa-dump "is passed to local function...Excluded." "ipa_struct_reorg" } } */
46 /* { dg-final { cleanup-ipa-dump "*" } } */