[Bug c/24020] New: Excessive (x20) stack usage for 4.0 with -O3

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug c/24020] New: Excessive (x20) stack usage for 4.0 with -O3

cvs-commit at gcc dot gnu.org
When compiling the attached program (-std=c99 -march=i486 -O?), GCC allocates
the following stacks for the recursive function "f" (in bytes):

GCC 3.4.5 (20050821)   -O2: 16   -O3: 16
GCC 4.0.2 (20050917)   -O2: 40   -O3: 360 (!)
GCC 4.1.0 (20050904)   -O2: 28   -O3: 28

There are only 10 local int variables in the function, so the 360-byte
consumption with GCC 4.0.2 seems a bit high, with respect to the 16 bytes with
GCC 3.4.5. Especially since the code actually runs 25% slower when compiled with
4.0.2 whatever the optimization level (17% with 4.1.0).

--
           Summary: Excessive (x20) stack usage for 4.0 with -O3
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: guillaume dot melquiond at ens-lyon dot fr
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: i486-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24020
Reply | Threaded
Open this post in threaded view
|

[Bug c/24020] Excessive (x20) stack usage for 4.0 with -O3

cvs-commit at gcc dot gnu.org

------- Additional Comments From guillaume dot melquiond at ens-lyon dot fr  2005-09-22 20:16 -------
Created an attachment (id=9793)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9793&action=view)
Testcase


--


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24020
Reply | Threaded
Open this post in threaded view
|

[Bug middle-end/24020] Excessive (x20) stack usage for 4.0 with -O3

cvs-commit at gcc dot gnu.org
In reply to this post by cvs-commit at gcc dot gnu.org


--
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |middle-end


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24020
Reply | Threaded
Open this post in threaded view
|

[Bug middle-end/24020] [4.0 regression] Excessive (x20) recusive inlining for 4.0 with -O3

cvs-commit at gcc dot gnu.org
In reply to this post by cvs-commit at gcc dot gnu.org

------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-22 20:27 -------
This is just excessive recusive inlining.

--
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org, hubicka at gcc dot gnu
                   |                            |dot org
           Keywords|                            |missed-optimization
            Summary|Excessive (x20) stack usage |[4.0 regression] Excessive
                   |for 4.0 with -O3            |(x20) recusive inlining for
                   |                            |4.0 with -O3
   Target Milestone|---                         |4.0.2


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24020
Reply | Threaded
Open this post in threaded view
|

[Bug middle-end/24020] [4.0 regression] Excessive (x20) recusive inlining for 4.0 with -O3 and poor stack usage even without inlining

cvs-commit at gcc dot gnu.org
In reply to this post by cvs-commit at gcc dot gnu.org

------- Additional Comments From hubicka at gcc dot gnu dot org  2005-09-23 12:37 -------
There is no recursive inlining happening at least on 4.1 because of overall unit
growth limit is met, so we do remarkably worse compared to 3.4 anyway.
Enabling recursive inlining makes it very active.  This is side effect of last
growth model changes and I need to trottle this somehow.

Honza

--
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |hubicka at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
            Summary|[4.0 regression] Excessive  |[4.0 regression] Excessive
                   |(x20) recusive inlining for |(x20) recusive inlining for
                   |4.0 with -O3                |4.0 with -O3 and poor stack
                   |                            |usage even without inlining


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24020
Reply | Threaded
Open this post in threaded view
|

[Bug middle-end/24020] [4.0 regression] Excessive (x20) recusive inlining for 4.0 with -O3 and poor stack usage even without inlining

cvs-commit at gcc dot gnu.org
In reply to this post by cvs-commit at gcc dot gnu.org

------- Additional Comments From hubicka at gcc dot gnu dot org  2005-09-23 12:49 -------
The difference in stack usage is caused by ivopts.  -fno-ivopts reduces 4.1
stack usage to 12 bytes and 200 bytes with --param inline-unit-growth=1000000
Especially in the second case ivops should probably trottle down after some loop
nest as it makes no sense to increase number of induction variables for each of
loop of nest8.
I will look into saner recursive inlining limits too.

--
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|hubicka at gcc dot gnu dot  |rakdver at atrey dot karlin
                   |org                         |dot mff dot cuni dot cz


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24020
Reply | Threaded
Open this post in threaded view
|

[Bug middle-end/24020] [4.0 regression] Excessive (x20) recusive inlining for 4.0 with -O3 and poor stack usage even without inlining

cvs-commit at gcc dot gnu.org
In reply to this post by cvs-commit at gcc dot gnu.org


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


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