[patch] Optimize empty class copies within a C++ return statement

Jason Merrill jason@redhat.com
Fri Mar 6 22:01:00 GMT 2015


On 03/06/2015 04:54 PM, Aldy Hernandez wrote:
>> But doesn't this still involve a MODIFY_EXPR, i.e. return retval =
>> D.2349?
>
> If I understand you correct, no.
>
> gimplify_return_expr creates a new temporary and uses that instead of
> <retval>:
>
>    else if (gimplify_ctxp->return_temp)
>      result = gimplify_ctxp->return_temp;
>    else
>      {
>        result = create_tmp_reg (TREE_TYPE (result_decl));
>        ...
>      }
> ...
> ...
>    /* Smash the lhs of the MODIFY_EXPR to the temporary we plan to use.
>       Then gimplify the whole thing.  */
>    if (result != result_decl)
>      TREE_OPERAND (ret_expr, 0) = result;

Sounds like ret_expr is a MODIFY_EXPR.

Jason



More information about the Gcc-patches mailing list