This is the mail archive of the
mailing list for the GCC project.
Re: RFC: PATCH to gimplify_modify_expr_rhs to make return slot explicit
- From: Richard Henderson <rth at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Mark Mitchell <mark at codesourcery dot com>, "Frank Ch. Eigler" <fche at redhat dot com>
- Date: Wed, 19 Jan 2005 13:58:02 -0800
- Subject: Re: RFC: PATCH to gimplify_modify_expr_rhs to make return slot explicit
- References: <email@example.com>
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.