public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value
       [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
@ 2005-10-16 22:20 ` pinskia at gcc dot gnu dot org
  2005-10-31  5:00 ` mmitchel at gcc dot gnu dot org
                   ` (30 subsequent siblings)
  31 siblings, 0 replies; 46+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-16 22:20 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
           Severity|normal                      |minor


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value
       [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
  2005-10-16 22:20 ` [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value pinskia at gcc dot gnu dot org
@ 2005-10-31  5:00 ` mmitchel at gcc dot gnu dot org
  2006-01-14 12:40 ` [Bug c++/23372] [4.0/4.1/4.2 " rguenth at gcc dot gnu dot org
                   ` (29 subsequent siblings)
  31 siblings, 0 replies; 46+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-10-31  5:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from mmitchel at gcc dot gnu dot org  2005-10-31 05:00 -------
Leaving as P2.


-- 


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1/4.2 Regression] Temporary aggregate copy not elided when passing parameters by value
       [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
  2005-10-16 22:20 ` [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value pinskia at gcc dot gnu dot org
  2005-10-31  5:00 ` mmitchel at gcc dot gnu dot org
@ 2006-01-14 12:40 ` rguenth at gcc dot gnu dot org
  2006-01-14 17:12 ` rguenth at gcc dot gnu dot org
                   ` (28 subsequent siblings)
  31 siblings, 0 replies; 46+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-01-14 12:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #15 from rguenth at gcc dot gnu dot org  2006-01-14 12:40 -------
I decided to give this another look.  My hack is surely a progression on this
issue and maybe even appropriate for the branches.  Now trying to figure out
what goes wrong with it.


-- 


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1/4.2 Regression] Temporary aggregate copy not elided when passing parameters by value
       [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2006-01-14 12:40 ` [Bug c++/23372] [4.0/4.1/4.2 " rguenth at gcc dot gnu dot org
@ 2006-01-14 17:12 ` rguenth at gcc dot gnu dot org
  2006-01-30 13:46 ` rguenth at gcc dot gnu dot org
                   ` (27 subsequent siblings)
  31 siblings, 0 replies; 46+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-01-14 17:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #16 from rguenth at gcc dot gnu dot org  2006-01-14 17:12 -------
I have a fix which improves the situation by modifying the gimplifier.


-- 


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1/4.2 Regression] Temporary aggregate copy not elided when passing parameters by value
       [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2006-01-14 17:12 ` rguenth at gcc dot gnu dot org
@ 2006-01-30 13:46 ` rguenth at gcc dot gnu dot org
  2006-01-30 13:48 ` rguenth at gcc dot gnu dot org
                   ` (26 subsequent siblings)
  31 siblings, 0 replies; 46+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-01-30 13:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #17 from rguenth at gcc dot gnu dot org  2006-01-30 13:46 -------
Subject: Bug 23372

Author: rguenth
Date: Mon Jan 30 13:46:30 2006
New Revision: 110396

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=110396
Log:
2006-01-30  Richard Guenther  <rguenther@suse.de>

        PR c++/23372
        * gimplify.c (gimplify_target_expr): Handle easy cases
        without creating a temporary.

        * gcc.dg/pr23372-1.C: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/pr23372-1.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gimplify.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1/4.2 Regression] Temporary aggregate copy not elided when passing parameters by value
       [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2006-01-30 13:46 ` rguenth at gcc dot gnu dot org
@ 2006-01-30 13:48 ` rguenth at gcc dot gnu dot org
  2006-01-31 15:24 ` [Bug c++/23372] [4.0/4.1 " pinskia at gcc dot gnu dot org
                   ` (25 subsequent siblings)
  31 siblings, 0 replies; 46+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-01-30 13:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #18 from rguenth at gcc dot gnu dot org  2006-01-30 13:48 -------
The original testcase is now fixed on the mainline.


-- 


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value
       [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2006-01-30 13:48 ` rguenth at gcc dot gnu dot org
@ 2006-01-31 15:24 ` pinskia at gcc dot gnu dot org
  2006-01-31 16:03 ` rguenth at gcc dot gnu dot org
                   ` (24 subsequent siblings)
  31 siblings, 0 replies; 46+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-31 15:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #19 from pinskia at gcc dot gnu dot org  2006-01-31 15:24 -------
The test for this PR (gcc.dg/pr23372-1.c) fails on powerpc-darwin because there
is no memcpy outputted in the asm.
There is a loop:
L2:
        lbzx r0,r9,r2
        stbx r0,r11,r2
        addi r2,r2,1
L3:
        bdnz L2

But no memcpy.


-- 


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value
       [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2006-01-31 15:24 ` [Bug c++/23372] [4.0/4.1 " pinskia at gcc dot gnu dot org
@ 2006-01-31 16:03 ` rguenth at gcc dot gnu dot org
  2006-01-31 16:05 ` pinskia at gcc dot gnu dot org
                   ` (23 subsequent siblings)
  31 siblings, 0 replies; 46+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-01-31 16:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #20 from rguenth at gcc dot gnu dot org  2006-01-31 16:03 -------
So, { xfail powerpc*-darwin* } the test?


-- 


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value
       [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2006-01-31 16:03 ` rguenth at gcc dot gnu dot org
@ 2006-01-31 16:05 ` pinskia at gcc dot gnu dot org
  2006-01-31 16:05 ` pinskia at gcc dot gnu dot org
                   ` (22 subsequent siblings)
  31 siblings, 0 replies; 46+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-31 16:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #21 from pinskia at gcc dot gnu dot org  2006-01-31 16:05 -------
(In reply to comment #20)
> So, { xfail powerpc*-darwin* } the test?

More like
{ xfail powerpc*-*-darwin* powerpc*-*-aix* rs6000-*-* powerpc64-*-linux* &&
lp64 }


-- 


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value
       [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2006-01-31 16:05 ` pinskia at gcc dot gnu dot org
@ 2006-01-31 16:05 ` pinskia at gcc dot gnu dot org
  2006-02-02  9:16 ` rguenth at gcc dot gnu dot org
                   ` (21 subsequent siblings)
  31 siblings, 0 replies; 46+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-31 16:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #22 from pinskia at gcc dot gnu dot org  2006-01-31 16:05 -------
(In reply to comment #21)
> (In reply to comment #20)
> > So, { xfail powerpc*-darwin* } the test?
> 
> More like
> { xfail powerpc*-*-darwin* powerpc*-*-aix* rs6000-*-* powerpc64-*-linux* &&
> lp64 }

Or even better just don't run the test there as it is passing just not the way
you are expecting.


-- 


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value
       [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
                   ` (9 preceding siblings ...)
  2006-01-31 16:05 ` pinskia at gcc dot gnu dot org
@ 2006-02-02  9:16 ` rguenth at gcc dot gnu dot org
  2006-02-02 17:16 ` sje at cup dot hp dot com
                   ` (20 subsequent siblings)
  31 siblings, 0 replies; 46+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-02-02  9:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #23 from rguenth at gcc dot gnu dot org  2006-02-02 09:16 -------
I cannot get a target selector work that would exclude the patterns you
mention.  This seems to work though:

/* { dg-do compile { xfail { powerpc*-*-darwin* powerpc*-*-aix* rs6000-*-* } ||
{ powerpc64-*-linux* && lp64 } } } */


-- 


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value
       [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
                   ` (10 preceding siblings ...)
  2006-02-02  9:16 ` rguenth at gcc dot gnu dot org
@ 2006-02-02 17:16 ` sje at cup dot hp dot com
  2006-02-03  1:49 ` hp at gcc dot gnu dot org
                   ` (19 subsequent siblings)
  31 siblings, 0 replies; 46+ messages in thread
From: sje at cup dot hp dot com @ 2006-02-02 17:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #24 from sje at cup dot hp dot com  2006-02-02 17:16 -------
This test is also failing on hppa*-*-hpux* and ia64-*-hpux*.


-- 

sje at cup dot hp dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sje at cup dot hp dot com


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value
       [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
                   ` (11 preceding siblings ...)
  2006-02-02 17:16 ` sje at cup dot hp dot com
@ 2006-02-03  1:49 ` hp at gcc dot gnu dot org
  2006-02-03  9:16 ` rguenth at gcc dot gnu dot org
                   ` (18 subsequent siblings)
  31 siblings, 0 replies; 46+ messages in thread
From: hp at gcc dot gnu dot org @ 2006-02-03  1:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #25 from hp at gcc dot gnu dot org  2006-02-03 01:49 -------
Also fails for mmix-knuth-mmixware.  This is an ABI thing; callee copies if
it needs to modify (for MMIX, it's f() that does the memcpy).
Add testsuite framework or run only on specific targets, please.


-- 

hp at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hp at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value
       [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
                   ` (12 preceding siblings ...)
  2006-02-03  1:49 ` hp at gcc dot gnu dot org
@ 2006-02-03  9:16 ` rguenth at gcc dot gnu dot org
  2006-02-07 15:36 ` rguenth at gcc dot gnu dot org
                   ` (17 subsequent siblings)
  31 siblings, 0 replies; 46+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-02-03  9:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #26 from rguenth at gcc dot gnu dot org  2006-02-03 09:16 -------
Ok, I'll skim through the posted testresults and will restrict the test to
working targets.


-- 


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value
       [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
                   ` (13 preceding siblings ...)
  2006-02-03  9:16 ` rguenth at gcc dot gnu dot org
@ 2006-02-07 15:36 ` rguenth at gcc dot gnu dot org
  2006-02-07 15:39 ` [Bug c++/23372] [4.0/4.1/4.2 " rguenth at gcc dot gnu dot org
                   ` (16 subsequent siblings)
  31 siblings, 0 replies; 46+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-02-07 15:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #27 from rguenth at gcc dot gnu dot org  2006-02-07 15:36 -------
Subject: Bug 23372

Author: rguenth
Date: Tue Feb  7 15:36:44 2006
New Revision: 110699

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=110699
Log:
2006-02-07  Richard Guenther  <rguenther@suse.de>

        PR c++/26140
        Revert
        2006-01-30  Richard Guenther  <rguenther@suse.de>
        PR c++/23372
        * gimplify.c (gimplify_target_expr): Handle easy cases
        without creating a temporary.

        Revert
        2006-01-30  Richard Guenther  <rguenther@suse.de>
        PR c++/23372
        * gcc.dg/pr23372-1.C: New testcase.

        * g++.dg/tree-ssa/pr26140.C: New testcase.

Added:
    trunk/gcc/testsuite/g++.dg/tree-ssa/pr26140.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gimplify.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/pr23372-1.c


-- 


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1/4.2 Regression] Temporary aggregate copy not elided when passing parameters by value
       [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
                   ` (14 preceding siblings ...)
  2006-02-07 15:36 ` rguenth at gcc dot gnu dot org
@ 2006-02-07 15:39 ` rguenth at gcc dot gnu dot org
  2006-02-08 15:11 ` rguenth at gcc dot gnu dot org
                   ` (15 subsequent siblings)
  31 siblings, 0 replies; 46+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-02-07 15:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #28 from rguenth at gcc dot gnu dot org  2006-02-07 15:39 -------
So we regress for 4.2 again as the patch caused problems.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|4.0.0 4.1.0                 |4.0.0 4.1.0 4.2.0
      Known to work|3.4.0 3.3.3 3.2.3 3.0.4     |3.4.0 3.3.3 3.2.3 3.0.4
                   |2.95.3 4.2.0                |2.95.3
            Summary|[4.0/4.1 Regression]        |[4.0/4.1/4.2 Regression]
                   |Temporary aggregate copy not|Temporary aggregate copy not
                   |elided when passing         |elided when passing
                   |parameters by value         |parameters by value


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1/4.2 Regression] Temporary aggregate copy not elided when passing parameters by value
       [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
                   ` (15 preceding siblings ...)
  2006-02-07 15:39 ` [Bug c++/23372] [4.0/4.1/4.2 " rguenth at gcc dot gnu dot org
@ 2006-02-08 15:11 ` rguenth at gcc dot gnu dot org
  2006-02-08 15:16 ` rguenth at gcc dot gnu dot org
                   ` (14 subsequent siblings)
  31 siblings, 0 replies; 46+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-02-08 15:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #29 from rguenth at gcc dot gnu dot org  2006-02-08 15:11 -------
Created an attachment (id=10802)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10802&action=view)
patch for aggregate copyprop

This patch (on top of infrastructure provided by the general copyprop
improvements) modifies forwprop to do copy propagation of aggregates.  Untested
apart from the fact it fixes all the testcases here.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1/4.2 Regression] Temporary aggregate copy not elided when passing parameters by value
       [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
                   ` (16 preceding siblings ...)
  2006-02-08 15:11 ` rguenth at gcc dot gnu dot org
@ 2006-02-08 15:16 ` rguenth at gcc dot gnu dot org
  2006-02-08 15:16 ` pinskia at gcc dot gnu dot org
                   ` (13 subsequent siblings)
  31 siblings, 0 replies; 46+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-02-08 15:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #31 from rguenth at gcc dot gnu dot org  2006-02-08 15:16 -------
For reference, I talk about
http://gcc.gnu.org/ml/gcc-patches/2006-02/msg00669.html
excluding the tree-ssa-copy.c parts.


-- 


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1/4.2 Regression] Temporary aggregate copy not elided when passing parameters by value
       [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
                   ` (17 preceding siblings ...)
  2006-02-08 15:16 ` rguenth at gcc dot gnu dot org
@ 2006-02-08 15:16 ` pinskia at gcc dot gnu dot org
  2006-02-08 15:18 ` rguenth at gcc dot gnu dot org
                   ` (12 subsequent siblings)
  31 siblings, 0 replies; 46+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-08 15:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #30 from pinskia at gcc dot gnu dot org  2006-02-08 15:16 -------
(In reply to comment #29)
> This patch (on top of infrastructure provided by the general copyprop
> improvements) modifies forwprop to do copy propagation of aggregates.  Untested
> apart from the fact it fixes all the testcases here.

Forward prop is really a semi hack waiting for a true combiner.  And this seems
like the wrong spot anyways as forward prop is only really for scalars really.


-- 


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1/4.2 Regression] Temporary aggregate copy not elided when passing parameters by value
       [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
                   ` (18 preceding siblings ...)
  2006-02-08 15:16 ` pinskia at gcc dot gnu dot org
@ 2006-02-08 15:18 ` rguenth at gcc dot gnu dot org
  2006-02-14 15:41 ` rguenth at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  31 siblings, 0 replies; 46+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-02-08 15:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #32 from rguenth at gcc dot gnu dot org  2006-02-08 15:18 -------
Of course you are right.  But backporting this to 4.1 may be the only chance to
get the stackspace / extra temporaries regressions solved there, as using
forwprop for this hack is the most easiest (and frankly forwprop has become a
place exactly for such hacks already ;)).


-- 


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1/4.2 Regression] Temporary aggregate copy not elided when passing parameters by value
       [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
                   ` (19 preceding siblings ...)
  2006-02-08 15:18 ` rguenth at gcc dot gnu dot org
@ 2006-02-14 15:41 ` rguenth at gcc dot gnu dot org
  2006-02-14 15:41 ` rguenth at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  31 siblings, 0 replies; 46+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-02-14 15:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #34 from rguenth at gcc dot gnu dot org  2006-02-14 15:41 -------
We're not depending on struct copyprop here.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|14295                       |


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1/4.2 Regression] Temporary aggregate copy not elided when passing parameters by value
       [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
                   ` (20 preceding siblings ...)
  2006-02-14 15:41 ` rguenth at gcc dot gnu dot org
@ 2006-02-14 15:41 ` rguenth at gcc dot gnu dot org
  2006-02-24  0:30 ` mmitchel at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  31 siblings, 0 replies; 46+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-02-14 15:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #33 from rguenth at gcc dot gnu dot org  2006-02-14 15:40 -------
The attached patch is bogus, and a correct one doesn't fix the first testcase
(as the attached one didn't, too).  As analyzed previously, expand does not
deal with

void g(A*) (a)
{
  struct A D.2007;

<bb 2>:
  D.2007 = *a_1;
  f (D.2007) [tail call];
  return;

}

and TER doesn't produce (non-gimple) f (*a).  Still TER looks like the only
place where we could get this fixed, because we still have dataflow
information left.  Also a real struct copyprop pass will not help here.
As TER / outof-ssa is not something I want to look into, unassigning this.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|rguenth at gcc dot gnu dot  |unassigned at gcc dot gnu
                   |org                         |dot org
             Status|ASSIGNED                    |NEW


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1/4.2 Regression] Temporary aggregate copy not elided when passing parameters by value
       [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
                   ` (21 preceding siblings ...)
  2006-02-14 15:41 ` rguenth at gcc dot gnu dot org
@ 2006-02-24  0:30 ` mmitchel at gcc dot gnu dot org
  2006-04-06 10:59 ` guillaume dot melquiond at ens-lyon dot fr
                   ` (8 subsequent siblings)
  31 siblings, 0 replies; 46+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-02-24  0:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #35 from mmitchel at gcc dot gnu dot org  2006-02-24 00:26 -------
This issue will not be resolved in GCC 4.1.0; retargeted at GCC 4.1.1.


-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.3                       |4.1.1


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1/4.2 Regression] Temporary aggregate copy not elided when passing parameters by value
       [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
                   ` (22 preceding siblings ...)
  2006-02-24  0:30 ` mmitchel at gcc dot gnu dot org
@ 2006-04-06 10:59 ` guillaume dot melquiond at ens-lyon dot fr
  2006-05-25  2:34 ` mmitchel at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  31 siblings, 0 replies; 46+ messages in thread
From: guillaume dot melquiond at ens-lyon dot fr @ 2006-04-06 10:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #36 from guillaume dot melquiond at ens-lyon dot fr  2006-04-06 10:59 -------
The generated code is getting both better and worse. I just tested with GCC
4.1, and there is now a byte-by-byte (!) copy instead of memcpy. So not only
does GCC use superfluous copies, but it generates code such that these copies
are the slowest possible. On the other hand, there is only one copy left. So
this is better than GCC 4.0, but still worse than GCC 3.4.

        pushl   %ebp
        movl    %esp, %ebp
        pushl   %ebx
        subl    $8004, %esp
        leal    -4004(%ebp), %ebx
        movl    %ebx, (%esp)
        call    f
        xorl    %edx, %edx
        subl    $4, %esp
.L3:
        cmpl    $4000, %edx
        jb      .L2
        call    g
        movl    -4(%ebp), %ebx
        leave
        ret
        .p2align 4,,7
.L2:
        movzbl  (%ebx,%edx), %eax
        movb    %al, (%esp,%edx)
        incl    %edx
        jmp     .L3


-- 


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1/4.2 Regression] Temporary aggregate copy not elided when passing parameters by value
       [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
                   ` (23 preceding siblings ...)
  2006-04-06 10:59 ` guillaume dot melquiond at ens-lyon dot fr
@ 2006-05-25  2:34 ` mmitchel at gcc dot gnu dot org
  2006-08-22 21:09 ` jason at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  31 siblings, 0 replies; 46+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-05-25  2:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #37 from mmitchel at gcc dot gnu dot org  2006-05-25 02:33 -------
Will not be fixed in 4.1.1; adjust target milestone to 4.1.2.


-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.1.1                       |4.1.2


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1/4.2 Regression] Temporary aggregate copy not elided when passing parameters by value
       [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
                   ` (24 preceding siblings ...)
  2006-05-25  2:34 ` mmitchel at gcc dot gnu dot org
@ 2006-08-22 21:09 ` jason at gcc dot gnu dot org
  2006-08-23  4:28 ` jason at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  31 siblings, 0 replies; 46+ messages in thread
From: jason at gcc dot gnu dot org @ 2006-08-22 21:09 UTC (permalink / raw)
  To: gcc-bugs



-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jason at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2006-07-05 09:38:34         |2006-08-22 21:08:50
               date|                            |


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1/4.2 Regression] Temporary aggregate copy not elided when passing parameters by value
       [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
                   ` (25 preceding siblings ...)
  2006-08-22 21:09 ` jason at gcc dot gnu dot org
@ 2006-08-23  4:28 ` jason at gcc dot gnu dot org
  2006-08-23 14:23 ` [Bug c++/23372] [4.0/4.1 " jason at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  31 siblings, 0 replies; 46+ messages in thread
From: jason at gcc dot gnu dot org @ 2006-08-23  4:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #38 from jason at gcc dot gnu dot org  2006-08-23 04:27 -------
Subject: Bug 23372

Author: jason
Date: Wed Aug 23 04:27:43 2006
New Revision: 116342

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116342
Log:
        PR c++/23372
        * call.c (build_over_call): Don't make a copy here if build_call
        will make one too.

Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/call.c


-- 


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value
       [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
                   ` (26 preceding siblings ...)
  2006-08-23  4:28 ` jason at gcc dot gnu dot org
@ 2006-08-23 14:23 ` jason at gcc dot gnu dot org
  2006-08-23 14:23 ` jason at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  31 siblings, 0 replies; 46+ messages in thread
From: jason at gcc dot gnu dot org @ 2006-08-23 14:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #39 from jason at gcc dot gnu dot org  2006-08-23 14:22 -------
Subject: Bug 23372

Author: jason
Date: Wed Aug 23 14:22:41 2006
New Revision: 116351

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116351
Log:
        PR c++/23372
        * call.c (build_over_call): Don't make a copy here if build_call
        will make one too.

Modified:
    branches/gcc-4_0-branch/gcc/cp/ChangeLog
    branches/gcc-4_0-branch/gcc/cp/call.c


-- 


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value
       [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
                   ` (27 preceding siblings ...)
  2006-08-23 14:23 ` [Bug c++/23372] [4.0/4.1 " jason at gcc dot gnu dot org
@ 2006-08-23 14:23 ` jason at gcc dot gnu dot org
  2006-08-23 14:34 ` jason at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  31 siblings, 0 replies; 46+ messages in thread
From: jason at gcc dot gnu dot org @ 2006-08-23 14:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #40 from jason at gcc dot gnu dot org  2006-08-23 14:22 -------
Subject: Bug 23372

Author: jason
Date: Wed Aug 23 14:22:49 2006
New Revision: 116352

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116352
Log:
        PR c++/23372
        * call.c (build_over_call): Don't make a copy here if build_call
        will make one too.

Modified:
    branches/gcc-4_1-branch/gcc/cp/ChangeLog
    branches/gcc-4_1-branch/gcc/cp/call.c


-- 


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value
       [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
                   ` (28 preceding siblings ...)
  2006-08-23 14:23 ` jason at gcc dot gnu dot org
@ 2006-08-23 14:34 ` jason at gcc dot gnu dot org
  2006-10-07  3:49 ` pinskia at gcc dot gnu dot org
  2006-10-07  6:16 ` pinskia at gcc dot gnu dot org
  31 siblings, 0 replies; 46+ messages in thread
From: jason at gcc dot gnu dot org @ 2006-08-23 14:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #41 from jason at gcc dot gnu dot org  2006-08-23 14:33 -------
fixed in 4.0 and 4.1 as well.


-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value
       [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
                   ` (29 preceding siblings ...)
  2006-08-23 14:34 ` jason at gcc dot gnu dot org
@ 2006-10-07  3:49 ` pinskia at gcc dot gnu dot org
  2006-10-07  6:16 ` pinskia at gcc dot gnu dot org
  31 siblings, 0 replies; 46+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-10-07  3:49 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|3.4.0 3.3.3 3.2.3 3.0.4     |3.4.0 3.3.3 3.2.3 3.0.4
                   |2.95.3 4.2.0                |2.95.3 4.2.0 4.0.4 4.1.2
   Target Milestone|4.1.2                       |4.0.4


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value
       [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
                   ` (30 preceding siblings ...)
  2006-10-07  3:49 ` pinskia at gcc dot gnu dot org
@ 2006-10-07  6:16 ` pinskia at gcc dot gnu dot org
  31 siblings, 0 replies; 46+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-10-07  6:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #42 from pinskia at gcc dot gnu dot org  2006-10-07 06:16 -------
*** Bug 29375 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |deb at pixar dot com


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value
       [not found] <bug-23372-4@http.gcc.gnu.org/bugzilla/>
@ 2011-03-18 15:07 ` jason at gcc dot gnu.org
  0 siblings, 0 replies; 46+ messages in thread
From: jason at gcc dot gnu.org @ 2011-03-18 15:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #43 from Jason Merrill <jason at gcc dot gnu.org> 2011-03-18 15:06:54 UTC ---
Author: jason
Date: Fri Mar 18 15:06:51 2011
New Revision: 171146

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171146
Log:
    PR c++/23372
    * gimplify.c (gimplify_arg): Strip redundant TARGET_EXPR.

Added:
    trunk/gcc/testsuite/g++.dg/opt/pr23372.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gimplify.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value
  2005-08-13  8:03 [Bug c++/23372] New: " guillaume dot melquiond at ens-lyon dot fr
                   ` (11 preceding siblings ...)
  2005-09-14  6:36 ` pinskia at gcc dot gnu dot org
@ 2005-09-27 16:21 ` mmitchel at gcc dot gnu dot org
  12 siblings, 0 replies; 46+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-09-27 16:21 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.2                       |4.0.3


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value
  2005-08-13  8:03 [Bug c++/23372] New: " guillaume dot melquiond at ens-lyon dot fr
                   ` (10 preceding siblings ...)
  2005-08-29 13:15 ` rguenth at gcc dot gnu dot org
@ 2005-09-14  6:36 ` pinskia at gcc dot gnu dot org
  2005-09-27 16:21 ` mmitchel at gcc dot gnu dot org
  12 siblings, 0 replies; 46+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-14  6:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-14 06:36 -------
Another way to fix this would have copy-propagation for aggregates, see PR 14295.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |14295


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value
  2005-08-13  8:03 [Bug c++/23372] New: " guillaume dot melquiond at ens-lyon dot fr
                   ` (9 preceding siblings ...)
  2005-08-29 12:33 ` rguenth at gcc dot gnu dot org
@ 2005-08-29 13:15 ` rguenth at gcc dot gnu dot org
  2005-09-14  6:36 ` pinskia at gcc dot gnu dot org
  2005-09-27 16:21 ` mmitchel at gcc dot gnu dot org
  12 siblings, 0 replies; 46+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2005-08-29 13:15 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rguenth at gcc dot gnu dot org  2005-08-29 13:13 -------
One possibility would be to hack out-of-ssa to coalesce single use variables
with their defs in the case of aggregates.  The real fix would involve
expanding to rtl from ssa, so we have this information ready and need not
create these useless memcpy's.  Or whatever solution is more "correct" here
("fixing" the frontends will not work for the second testcase until we allow
function calls as arguments in gimple).

Anyway, here's the hack that passed bootstrapping and regtesting for C and C++
with only some tr1 tests failing:

Index: gimplify.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gimplify.c,v
retrieving revision 2.113.2.11
diff -c -3 -p -r2.113.2.11 gimplify.c
*** gimplify.c  16 Aug 2005 22:16:52 -0000      2.113.2.11
--- gimplify.c  29 Aug 2005 12:04:33 -0000
*************** gimplify_target_expr (tree *expr_p, tree
*** 3628,3633 ****
--- 3628,3641 ----

    if (init)
      {
+       /* Try to avoid the temporary if possible.  */
+       if (TREE_CODE (init) == INDIRECT_REF
+         && !TARGET_EXPR_CLEANUP (targ))
+       {
+         *expr_p = init;
+         return GS_OK;
+       }
+
        /* TARGET_EXPR temps aren't part of the enclosing block, so add it
         to the temps list.  */
       gimple_add_tmp_var (temp);



-- 


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value
  2005-08-13  8:03 [Bug c++/23372] New: " guillaume dot melquiond at ens-lyon dot fr
                   ` (8 preceding siblings ...)
  2005-08-26 17:40 ` guillaume dot melquiond at ens-lyon dot fr
@ 2005-08-29 12:33 ` rguenth at gcc dot gnu dot org
  2005-08-29 13:15 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 46+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2005-08-29 12:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rguenth at gcc dot gnu dot org  2005-08-29 12:15 -------
I may have a patch^Whack to fix the first testcase.  Let's see if it passes
testing...

-- 


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value
  2005-08-13  8:03 [Bug c++/23372] New: " guillaume dot melquiond at ens-lyon dot fr
                   ` (7 preceding siblings ...)
  2005-08-26 14:59 ` rguenth at gcc dot gnu dot org
@ 2005-08-26 17:40 ` guillaume dot melquiond at ens-lyon dot fr
  2005-08-29 12:33 ` rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 46+ messages in thread
From: guillaume dot melquiond at ens-lyon dot fr @ 2005-08-26 17:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From guillaume dot melquiond at ens-lyon dot fr  2005-08-26 17:38 -------
> all of 3.4 and 4.1 produce exactly two temporaries.

Yet I said that g++ 3.4 did not produce any temporary, and I still think so. No
temporaries, only g's stack frame. See the following assembly code for the C
testcase (the generated assembly is the same as for C++, but easier to read
since there is no name mangling nor local labels).

h:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $4008, %esp
        movl    %esp, %eax
        subl    $12, %esp
        pushl   %eax
        call    f
        addl    $12, %esp
        call    g
        leave
        ret

For the sake of completeness, I'm also writing the assembly output for GCC 4.0,
so that the regression with respect to GCC 3.4 is clearly visible. Two
temporaries and two memory copies:

h:
        pushl   %ebp
        movl    %esp, %ebp
        pushl   %esi
        pushl   %ebx
        subl    $8012, %esp
        leal    -8008(%ebp), %ebx
        pushl   %ebx
        call    f
        leal    -4008(%ebp), %esi
        subl    $8, %esp
        pushl   $4000
        pushl   %ebx
        pushl   %esi
        call    memcpy
        subl    $3968, %esp
        movl    %esp, %eax
        pushl   %edx
        pushl   $4000
        pushl   %esi
        pushl   %eax
        call    memcpy
        addl    $16, %esp
        call    g
        addl    $4000, %esp
        leal    -8(%ebp), %esp
        popl    %ebx
        popl    %esi
        popl    %ebp
        ret

The C testcase is almost identical to the C++ testcase:

typedef struct A { int a[1000]; } A;
A f();
void g(A);
void h() { g(f()); }

And this is my version of GCC 3.4:

$ LANG=C gcc-3.4 -v
Reading specs from /usr/lib/gcc/i486-linux-gnu/3.4.5/specs
Configured with: ../src/configure -v
--enable-languages=c,c++,f77,pascal,objc,ada --prefix=/usr --libexecdir=/usr/lib
--with-gxx-include-dir=/usr/include/c++/3.4 --enable-shared --with-system-zlib
--enable-nls --without-included-gettext --program-suffix=-3.4
--enable-__cxa_atexit --enable-libstdcxx-allocator=mt --enable-clocale=gnu
--enable-libstdcxx-debug i486-linux-gnu
Thread model: posix
gcc version 3.4.5 20050821 (prerelease) (Debian 3.4.4-8)

Hope it helps.

-- 


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value
  2005-08-13  8:03 [Bug c++/23372] New: " guillaume dot melquiond at ens-lyon dot fr
                   ` (6 preceding siblings ...)
  2005-08-14  6:45 ` guillaume dot melquiond at ens-lyon dot fr
@ 2005-08-26 14:59 ` rguenth at gcc dot gnu dot org
  2005-08-26 17:40 ` guillaume dot melquiond at ens-lyon dot fr
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 46+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2005-08-26 14:59 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rguenth at gcc dot gnu dot org  2005-08-26 14:30 -------
For your last testcase,

struct A { int a[1000]; }
A f();
void g(A);
void h() { g(f()); }

all of 3.4 and 4.1 produce exactly two temporaries.
One to dump the result of f(), which get's copied to a new temp passed to g().

4.0 though produces one extra unnecessary copy.

The same holds true for C testcases.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   GCC host triplet|i486-linux-gnu              |


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value
  2005-08-13  8:03 [Bug c++/23372] New: " guillaume dot melquiond at ens-lyon dot fr
                   ` (5 preceding siblings ...)
  2005-08-13 21:21 ` rguenth at gcc dot gnu dot org
@ 2005-08-14  6:45 ` guillaume dot melquiond at ens-lyon dot fr
  2005-08-26 14:59 ` rguenth at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 46+ messages in thread
From: guillaume dot melquiond at ens-lyon dot fr @ 2005-08-14  6:45 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From guillaume dot melquiond at ens-lyon dot fr  2005-08-14 06:45 -------
Looking at it again, I found an even worse regression with respect to g++ 3.4.
Consider this testcase:

struct A { int a[1000]; }
A f();
void g(A);
void h() { g(f()); }

Ideally, h will allocate a stack frame for g and ask f to directly dump its
result in it. No temporary nor memcpy will be used at all. g++ 3.4 behaves this way.

g++ 4.0 however will first allocate some space for the result of f, then call f
and copy its result in another temporary, and finally it will allocate the stack
frame for g and copy the temporary in it. Two temporaries and two memcpys are
needed for g++ 4.0.

So the same issue arises when returning a result by value.

-- 


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value
  2005-08-13  8:03 [Bug c++/23372] New: " guillaume dot melquiond at ens-lyon dot fr
                   ` (4 preceding siblings ...)
  2005-08-13 18:16 ` rguenth at tat dot physik dot uni-tuebingen dot de
@ 2005-08-13 21:21 ` rguenth at gcc dot gnu dot org
  2005-08-14  6:45 ` guillaume dot melquiond at ens-lyon dot fr
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 46+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2005-08-13 21:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rguenth at gcc dot gnu dot org  2005-08-13 21:21 -------
The best place to fix this is probably still the expander or TER.  Or
out-of-ssa, where the necessary information is best present.  Or fix gimple and
gimplification.

-- 


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value
  2005-08-13  8:03 [Bug c++/23372] New: " guillaume dot melquiond at ens-lyon dot fr
                   ` (3 preceding siblings ...)
  2005-08-13 18:13 ` pinskia at gcc dot gnu dot org
@ 2005-08-13 18:16 ` rguenth at tat dot physik dot uni-tuebingen dot de
  2005-08-13 21:21 ` rguenth at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 46+ messages in thread
From: rguenth at tat dot physik dot uni-tuebingen dot de @ 2005-08-13 18:16 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rguenth at tat dot physik dot uni-tuebingen dot de  2005-08-13 18:16 -------
Indeed - adding a destructor (or anything else that makes it a non-POD) "fixes"
the problem, too.

-- 


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value
  2005-08-13  8:03 [Bug c++/23372] New: " guillaume dot melquiond at ens-lyon dot fr
                   ` (2 preceding siblings ...)
  2005-08-13 18:11 ` rguenth at tat dot physik dot uni-tuebingen dot de
@ 2005-08-13 18:13 ` pinskia at gcc dot gnu dot org
  2005-08-13 18:16 ` rguenth at tat dot physik dot uni-tuebingen dot de
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 46+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-13 18:13 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-13 18:12 -------
(In reply to comment #4)
> which confuses me a bit, because here the prototype of f looks like
> effectively
> 
> void f(A*);

No that is correct as it turns the class into a non pod and non pods are always passed via reference and 
not via value.

-- 


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value
  2005-08-13  8:03 [Bug c++/23372] New: " guillaume dot melquiond at ens-lyon dot fr
  2005-08-13 17:57 ` [Bug c++/23372] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
  2005-08-13 18:00 ` giovannibajo at libero dot it
@ 2005-08-13 18:11 ` rguenth at tat dot physik dot uni-tuebingen dot de
  2005-08-13 18:13 ` pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 46+ messages in thread
From: rguenth at tat dot physik dot uni-tuebingen dot de @ 2005-08-13 18:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rguenth at tat dot physik dot uni-tuebingen dot de  2005-08-13 18:11 -------
With the copy ctor we end up with

void g(A*) (a)
{
  struct A D.1603;

<bb 0>:
  __comp_ctor  (&D.1603, a);
  f (&D.1603);
  return;

}

which confuses me a bit, because here the prototype of f looks like
effectively

void f(A*);

do we use ABI information here, but not in the other case?  The C++
frontend in this case presents us with

{
  <<cleanup_point <<< Unknown tree: expr_stmt
  f (&TARGET_EXPR <D.1603, <<< Unknown tree: aggr_init_expr
  __comp_ctor
  0B, (struct A &) (struct A *) NON_LVALUE_EXPR <a>
  D.1603 >>>
>) >>>
>>;
}

where in the case w/o the copy ctor we have

  <<cleanup_point <<< Unknown tree: expr_stmt
  f (TARGET_EXPR <D.1608, *(struct A &) (struct A *) NON_LVALUE_EXPR <a>>) >>>
>>;

is there some different wording about by-value parameter passing
with or without explicit copy ctor in the C++ standard?!  I.e., why
isn't the above

  <<cleanup_point <<< Unknown tree: expr_stmt
  f (&TARGET_EXPR <D.1608, *(struct A &) (struct A *) NON_LVALUE_EXPR <a>>) >>>
>>;

?

-- 


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value
  2005-08-13  8:03 [Bug c++/23372] New: " guillaume dot melquiond at ens-lyon dot fr
  2005-08-13 17:57 ` [Bug c++/23372] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
@ 2005-08-13 18:00 ` giovannibajo at libero dot it
  2005-08-13 18:11 ` rguenth at tat dot physik dot uni-tuebingen dot de
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 46+ messages in thread
From: giovannibajo at libero dot it @ 2005-08-13 18:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2005-08-13 18:00 -------
Why doesn't this happen with the copy constructor, then? there we should be 
calling the copyctor with *a, which would have the same problem.

-- 


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value
  2005-08-13  8:03 [Bug c++/23372] New: " guillaume dot melquiond at ens-lyon dot fr
@ 2005-08-13 17:57 ` pinskia at gcc dot gnu dot org
  2005-08-13 18:00 ` giovannibajo at libero dot it
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 46+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-13 17:57 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-13 17:56 -------
Confirmed.

(In reply to comment #1)
> after the tree optimizers.  f (*a) would not be gimple, so we create
> the temporary in the first place.  TER does not remove this wart,
> neither does expand - so we start with two memcpys after RTL expansion.
TER only works on scalars so it cannot work.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |missed-optimization
      Known to fail|                            |4.0.0 4.1.0
      Known to work|                            |3.4.0 3.3.3 3.2.3 3.0.4
                   |                            |2.95.3
   Last reconfirmed|0000-00-00 00:00:00         |2005-08-13 17:56:39
               date|                            |
            Summary|Temporary aggregate copy not|[4.0/4.1 Regression]
                   |elided when passing         |Temporary aggregate copy not
                   |parameters by value         |elided when passing
                   |                            |parameters by value
   Target Milestone|---                         |4.0.2


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


^ permalink raw reply	[flat|nested] 46+ messages in thread

end of thread, other threads:[~2011-03-18 15:07 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-23372-7904@http.gcc.gnu.org/bugzilla/>
2005-10-16 22:20 ` [Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value pinskia at gcc dot gnu dot org
2005-10-31  5:00 ` mmitchel at gcc dot gnu dot org
2006-01-14 12:40 ` [Bug c++/23372] [4.0/4.1/4.2 " rguenth at gcc dot gnu dot org
2006-01-14 17:12 ` rguenth at gcc dot gnu dot org
2006-01-30 13:46 ` rguenth at gcc dot gnu dot org
2006-01-30 13:48 ` rguenth at gcc dot gnu dot org
2006-01-31 15:24 ` [Bug c++/23372] [4.0/4.1 " pinskia at gcc dot gnu dot org
2006-01-31 16:03 ` rguenth at gcc dot gnu dot org
2006-01-31 16:05 ` pinskia at gcc dot gnu dot org
2006-01-31 16:05 ` pinskia at gcc dot gnu dot org
2006-02-02  9:16 ` rguenth at gcc dot gnu dot org
2006-02-02 17:16 ` sje at cup dot hp dot com
2006-02-03  1:49 ` hp at gcc dot gnu dot org
2006-02-03  9:16 ` rguenth at gcc dot gnu dot org
2006-02-07 15:36 ` rguenth at gcc dot gnu dot org
2006-02-07 15:39 ` [Bug c++/23372] [4.0/4.1/4.2 " rguenth at gcc dot gnu dot org
2006-02-08 15:11 ` rguenth at gcc dot gnu dot org
2006-02-08 15:16 ` rguenth at gcc dot gnu dot org
2006-02-08 15:16 ` pinskia at gcc dot gnu dot org
2006-02-08 15:18 ` rguenth at gcc dot gnu dot org
2006-02-14 15:41 ` rguenth at gcc dot gnu dot org
2006-02-14 15:41 ` rguenth at gcc dot gnu dot org
2006-02-24  0:30 ` mmitchel at gcc dot gnu dot org
2006-04-06 10:59 ` guillaume dot melquiond at ens-lyon dot fr
2006-05-25  2:34 ` mmitchel at gcc dot gnu dot org
2006-08-22 21:09 ` jason at gcc dot gnu dot org
2006-08-23  4:28 ` jason at gcc dot gnu dot org
2006-08-23 14:23 ` [Bug c++/23372] [4.0/4.1 " jason at gcc dot gnu dot org
2006-08-23 14:23 ` jason at gcc dot gnu dot org
2006-08-23 14:34 ` jason at gcc dot gnu dot org
2006-10-07  3:49 ` pinskia at gcc dot gnu dot org
2006-10-07  6:16 ` pinskia at gcc dot gnu dot org
     [not found] <bug-23372-4@http.gcc.gnu.org/bugzilla/>
2011-03-18 15:07 ` jason at gcc dot gnu.org
2005-08-13  8:03 [Bug c++/23372] New: " guillaume dot melquiond at ens-lyon dot fr
2005-08-13 17:57 ` [Bug c++/23372] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
2005-08-13 18:00 ` giovannibajo at libero dot it
2005-08-13 18:11 ` rguenth at tat dot physik dot uni-tuebingen dot de
2005-08-13 18:13 ` pinskia at gcc dot gnu dot org
2005-08-13 18:16 ` rguenth at tat dot physik dot uni-tuebingen dot de
2005-08-13 21:21 ` rguenth at gcc dot gnu dot org
2005-08-14  6:45 ` guillaume dot melquiond at ens-lyon dot fr
2005-08-26 14:59 ` rguenth at gcc dot gnu dot org
2005-08-26 17:40 ` guillaume dot melquiond at ens-lyon dot fr
2005-08-29 12:33 ` rguenth at gcc dot gnu dot org
2005-08-29 13:15 ` rguenth at gcc dot gnu dot org
2005-09-14  6:36 ` pinskia at gcc dot gnu dot org
2005-09-27 16:21 ` mmitchel at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).