https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101273

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Iain Buclaw
<ibuc...@gcc.gnu.org>:

https://gcc.gnu.org/g:46d1cb4c218ff1fb73b391a28218ee1f362e8ca1

commit r11-8688-g46d1cb4c218ff1fb73b391a28218ee1f362e8ca1
Author: Iain Buclaw <ibuc...@gdcproject.org>
Date:   Sat Jul 3 02:42:14 2021 +0200

    d: Missed RVO optimization with non-POD structs

    The D front-end semantic pass sometimes declares a temporary inside a
    return expression.  This is now detected with the RESULT_DECL replacing
    the temporary, allowing for RVO to be done.

            PR d/101273

    gcc/d/ChangeLog:

            * toir.cc (IRVisitor::visit (ReturnStatement *)): Detect returns
that
            use a temporary, and replace with return value.

    gcc/testsuite/ChangeLog:

            * gdc.dg/torture/pr101273.d: New test.

    (cherry picked from commit 152f4d0e4d3b524ce30d05f20e23a44b0dd29765)

Reply via email to