OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [nrv4.c] - Blame information for rev 154

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* Verify that NRV optimizations are prohibited when the LHS is an
2
   indirect reference to something that may be call-clobbered. */
3
/* { dg-do compile } */
4
/* { dg-options "-O -fdump-tree-optimized" } */
5
 
6
typedef struct { int x[20]; void *y; } S;
7
S nrv_candidate (void);
8
void use_result (S);
9
void make_escape (S *);
10
S global_S;
11
void foo (void)
12
{
13
  S *result;
14
  S local_S;
15
 
16
  /* We can't perform return slot optimization because global_S is
17
     global and may be clobbered by nrv_candidate.  */
18
  result = &global_S;
19
  *result = nrv_candidate ();
20
  use_result (*result);
21
 
22
  /* We can't perform return slot optimization because local_S is
23
     call_clobbered (its address escapes prior to invoking
24
     nrv_candidate).  */
25
  make_escape (&local_S);
26
  result = &local_S;
27
  *result = nrv_candidate ();
28
  use_result (*result);
29
}
30
 
31
/* { dg-final { scan-tree-dump-times "return slot optimization" 0 "optimized" } } */
32
/* { dg-final { cleanup-tree-dump "optimized" } } */
33
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.