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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:94e2418780f1d13235f3e2e6e5c09dbe821c1ce3

commit r10-7284-g94e2418780f1d13235f3e2e6e5c09dbe821c1ce3
Author: Jason Merrill <ja...@redhat.com>
Date:   Thu Mar 19 11:06:52 2020 -0400

    c++: Avoid unnecessary empty class copy [94175].

    A simple empty class copy is still simple when wrapped in a TARGET_EXPR, so
    we need to strip that as well.  This change also exposed some unnecessary
    copies in return statements, which when returning by invisible reference
led
    to <RETURN_EXPR <MEM_REF <RESULT_DECL>>>, which gimplify_return_expr didn't
    like.  So we also need to strip the _REF when we eliminate the INIT_EXPR.

    gcc/cp/ChangeLog
    2020-03-19  Jason Merrill  <ja...@redhat.com>

            PR c++/94175
            * cp-gimplify.c (simple_empty_class_p): Look through
            SIMPLE_TARGET_EXPR_P.
            (cp_gimplify_expr) [MODIFY_EXPR]: Likewise.
            [RETURN_EXPR]: Avoid producing 'return *retval;'.
            * call.c (build_call_a): Strip TARGET_EXPR from empty class arg.
            * cp-tree.h (SIMPLE_TARGET_EXPR_P): Check that TARGET_EXPR_INITIAL
            is non-null.

Reply via email to