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: RFC: PATCH to gimplify_modify_expr_rhs to make return slot explicit


On Wed, Jan 12, 2005 at 09:34:12PM -0500, Jason Merrill wrote:
> An early version of this patch performed this transformation
> unconditionally, as the rtl version in expand_call does.  However, a
> problem occurred to me:  if we elide both the copy from the user variable
> (the NRV optimization) and the copy from the return slot (this
> optimization), we can end up combining a local variable in the called
> function with a globally visible object:

Another alternative is to do this lowering later.  As late as possible,
actually.  This has a couple of advantages:

(1) Don't have to worry about optimizers thinking the object address
    leaks as with an address passed normally.

(2) Don't take the address of a variable that we might otherwise be
    able to scalarize.

(3) We'll have a much clearer picture of when we need to use a temporary,
    since we'll have true escape analysis results.


r~


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