annotate gcc/testsuite/gcc.dg/nrv3.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Verify that gimple-level NRV is occurring when values other than the
kono
parents:
diff changeset
2 return slot are call-clobbered. */
kono
parents:
diff changeset
3 /* { dg-do compile } */
kono
parents:
diff changeset
4 /* { dg-options "-O -fdump-tree-optimized" } */
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 typedef struct { int x[20]; void *y; } S;
kono
parents:
diff changeset
7 typedef struct { int a; S b; } T;
kono
parents:
diff changeset
8 S nrv_candidate (void);
kono
parents:
diff changeset
9 void use_result (S, int);
kono
parents:
diff changeset
10 int *ptr;
kono
parents:
diff changeset
11 void foo (void)
kono
parents:
diff changeset
12 {
kono
parents:
diff changeset
13 S result;
kono
parents:
diff changeset
14 T result_arr[10][5];
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 int i;
kono
parents:
diff changeset
17
kono
parents:
diff changeset
18 ptr = &i;
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 /* i is call-clobbered for these calls, but result and result_arr
kono
parents:
diff changeset
21 aren't. */
kono
parents:
diff changeset
22 result = nrv_candidate ();
kono
parents:
diff changeset
23 result_arr[3][4].b = nrv_candidate ();
kono
parents:
diff changeset
24
kono
parents:
diff changeset
25 use_result (result, i);
kono
parents:
diff changeset
26 use_result (result_arr[3][4].b, i);
kono
parents:
diff changeset
27 }
kono
parents:
diff changeset
28
kono
parents:
diff changeset
29 /* { dg-final { scan-tree-dump-times "return slot optimization" 2 "optimized" } } */