public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/38854]  New: missed optimization with -m32: empty functions shouldn't contain push/mov/pop
@ 2009-01-15  9:18 edwintorok at gmail dot com
  2009-01-15  9:45 ` [Bug rtl-optimization/38854] " rguenth at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: edwintorok at gmail dot com @ 2009-01-15  9:18 UTC (permalink / raw)
  To: gcc-bugs

Testcase:
void noop(char* foo) {}

For 64-bit it does the right thing:
$ gcc -O2 foo.c -S

Output is:
noop:
.LFB2:
        rep
        ret

However for 32-bit it has useless extra instructions:
$ gcc -m32 -O2 foo.c -S

noop:
        pushl   %ebp
        movl    %esp, %ebp
        popl    %ebp
        ret

The push/mov/pop should be removed.

I tested this with gcc-4.2, 4.3, and 4.4(trunk revision 143382), all produce
same code.


-- 
           Summary: missed optimization with -m32: empty functions shouldn't
                    contain push/mov/pop
           Product: gcc
           Version: 4.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: edwintorok at gmail dot com
 GCC build triplet: x86_64-linux-gnu
  GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu


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


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

end of thread, other threads:[~2009-01-15 14:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-15  9:18 [Bug rtl-optimization/38854] New: missed optimization with -m32: empty functions shouldn't contain push/mov/pop edwintorok at gmail dot com
2009-01-15  9:45 ` [Bug rtl-optimization/38854] " rguenth at gcc dot gnu dot org
2009-01-15  9:50 ` edwintorok at gmail dot com
2009-01-15  9:51 ` edwintorok at gmail dot com
2009-01-15 11:15 ` steven at gcc dot gnu dot org
2009-01-15 14:37 ` rguenth 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).