Re: Use the stack less :)

Diego Novillo <dnovillo@redhat.com>
15 Apr 2004 20:22:18 -0400

          From comp.compilers

Related articles
Use the stack less :) chriswalton87@hotmail.com (2004-04-15)
Re: Use the stack less :) dnovillo@redhat.com (Diego Novillo) (2004-04-15)
Re: Use the stack less :) wyrmwif@tsoft.com (SM Ryan) (2004-04-15)
Re: Use the stack less :) TommyAtNumba-Tu.Com--not@yahoo.com (Tommy Thorn) (2004-04-21)
Re: Use the stack less :) dSpam@arcor.de (Dietmar Schindler) (2004-04-21)
| List of all articles for this month |
From: Diego Novillo <dnovillo@redhat.com>
Newsgroups: comp.compilers
Date: 15 Apr 2004 20:22:18 -0400
Organization: Red Hat Canada
References: 04-04-052
Keywords: code, optimize
Posted-Date: 15 Apr 2004 20:22:18 EDT

On Thu, 2004-04-15 at 12:30, Ark? wrote:


> void blah(int a, char b)
> {
> int c;
> a++; b++; c++
> }
>
> IT doesn't do much, but it serves our purpose well. Regular GCC will
> compile this as:
> pushl %ebp
> movl %esp, %ebp
> subl $8, %esp
> movl 12(%ebp), %eax
> movb %al, -1(%ebp)
> incl 8(%ebp)
> leal -1(%ebp), %eax
> incb (%eax)
> leal -8(%ebp), %eax
> incl (%eax)
> leave
> ret
>
You didn't use -O2, did you? If you have a test case with no trivially
dead code, please file a bug report at http://gcc.gnu.org/bugzilla/


Diego.
[Here's what I get with -O3 and omit frame pointer:


.globl blah
                .type blah,@function
blah:
                ret


-John]



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.