diff options
| author | Iain Buclaw <ibuclaw@gdcproject.org> | 2026-01-28 12:45:26 +0100 |
|---|---|---|
| committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2026-01-28 15:50:00 +0100 |
| commit | 92f976fc2a87a867f70921b577f7c79acd214eaf (patch) | |
| tree | 79e97fb8a5f26b698f7d5e7fab31aa6cc01c9cb6 /libjava/gnu/java | |
| parent | 3090d28ab359e8299aee33386dc44b81faf8edca (diff) | |
| download | gcc-92f976fc2a87a867f70921b577f7c79acd214eaf.zip gcc-92f976fc2a87a867f70921b577f7c79acd214eaf.tar.gz gcc-92f976fc2a87a867f70921b577f7c79acd214eaf.tar.bz2 | |
d: RVO/NRVO not done when returning a copy constructor
RVO was already being done when returning a constructor call via a
temporary, which in the front-end AST looks like:
return S.this((__tmp = {}, &__tmp), args...);
But this was not being done for copy construction calls, which instead
looks like:
return __copytmp = {}, S.this(&__copytmp, V(1).s), __copytmp;
This pattern is now matched and the temporary gets set up as a
DECL_VALUE_EXPR of the RESULT_DECL.
PR d/123422
gcc/d/ChangeLog:
* expr.cc (ExprVisitor::visit (ArrayLiteralExp *)): Don't add
TARGET_EXPR around constructor.
* toir.cc (IRVisitor::visit (ReturnStatement *)): Recognize more
patterns for return value optimization.
gcc/testsuite/ChangeLog:
* gdc.dg/torture/pr123422.d: New test.
Diffstat (limited to 'libjava/gnu/java')
0 files changed, 0 insertions, 0 deletions
