gcc/testsuite/g++.dg/opt/nrv12.C
raw| 1 | /* Verify that gimple-level NRV is occurring even for RESULT_DECLs. */ |
| 2 | /* { dg-do compile { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ |
| 3 | /* { dg-options "-O -fdump-tree-optimized" } */ |
| 4 | |
| 5 | struct P |
| 6 | { |
| 7 | long long l; |
| 8 | int a; |
| 9 | unsigned int b; |
| 10 | P(long long x) : l(x) {} |
| 11 | }; |
| 12 | |
| 13 | P foo (P); |
| 14 | P bar (P); |
| 15 | |
| 16 | P foo (P x) |
| 17 | { |
| 18 | P y = P (-1LL); |
| 19 | y = bar (x); |
| 20 | return y; |
| 21 | } |
| 22 | |
| 23 | /* { dg-final { scan-tree-dump-times "return slot optimization" 1 "optimized" } } */ |