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


Richard Henderson wrote:
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:

Yes, but that still leaves the mudflap problem open. pass_mudflap_1 needs to figure out, somehow, that this particular DECL is interesting to it. Perhaps mudflap ought to not rely on TREE_ADDRESSABLE alone, and ask whether the symbol is addressable or the target of a call that will force its address in the return slot.

(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.

Agreed. Exposing this too early is not kind to the optimizers.


Diego.



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