This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


On 03/06/2015 05:01 PM, Jason Merrill wrote:
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.

Oh, but with the wrong lhs, I see.

Jason



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]