aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/opt/nrv12.C
blob: 55933753c7d32fbef7f3d3c935e474837dd2418f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* Verify that gimple-level NRV is occurring even for RESULT_DECLs.  */
/* { dg-do compile { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
/* { dg-options "-O -fdump-tree-optimized" } */

struct P
{
  long long l;
  int a;
  unsigned int b;
  P(long long x) : l(x) {}
};

P foo (P);
P bar (P);

P foo (P x)
{
  P y = P (-1LL);
  y = bar (x);
  return y;
}

/* { dg-final { scan-tree-dump-times "return slot optimization" 1 "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */