[Bug middle-end/28831] [4.0/4.1/4.2 Regression] Aggregate copy not elided when using a return value as a pass-by-value parameter

guillaume dot melquiond at ens-lyon dot fr gcc-bugzilla@gcc.gnu.org
Fri Aug 25 08:35:00 GMT 2006



------- Comment #3 from guillaume dot melquiond at ens-lyon dot fr  2006-08-25 08:34 -------
> Which looks ok if we are passing via value but since we need to pass by
> reference, the middle-end thinks we need a new stack space for it because it
> does not know that D.1992 is not used after the call to g.

Isn't it the other way around? There is no problem if we are passing by
reference, as the code then looks like "g (&D.1992);". The middle-end will not
do any copy. But, because we are passing by value, D.1992 is copied into the
stack frame instead. I understand your point about the middle-end having to
ensure that D.1992 is not used after g in order to store it directly into the
stack frame of g. But isn't this information already available to the
middle-end?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28831



More information about the Gcc-bugs mailing list