[LLVMbugs] [Bug 1937] The StructReturn attribute should imply a copy

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Jan 21 11:41:53 PST 2008


http://llvm.org/bugs/show_bug.cgi?id=1937


Chris Lattner <sabre at nondot.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




--- Comment #1 from Chris Lattner <sabre at nondot.org>  2008-01-21 13:41:46 ---
I don't think this makes sense.  The major difference between byval and stret
is that with stret the caller *must* allocate or provide the space for callee
to use.  If there was an implicit copy, the callee would be writing into some
memory that the caller could not access.

More significantly, exposing the destination buffer to the caller allows us to
do various optimizations, including eliminate copy ctors in C++ (which llvm-g++
already does with "TARGET_EXPR"), reuse allocas for return values (we don't do
this, but should someday) etc.

I'm not sure what you mean by "On x86-32 the ABI results in a copy
anyway (so here two copies are currently made)".

-Chris


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list