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
* [Bug rtl-optimization/38854] missed optimization with -m32: empty functions shouldn't contain push/mov/pop
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 ` rguenth at gcc dot gnu dot org
2009-01-15 9:50 ` edwintorok at gmail dot com
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-01-15 9:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from rguenth at gcc dot gnu dot org 2009-01-15 09:45 -------
This is the frame-pointer setup code. You can get the same code as x86_64 with
-momit-leaf-frame-pointer.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38854
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug rtl-optimization/38854] missed optimization with -m32: empty functions shouldn't contain push/mov/pop
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
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: edwintorok at gmail dot com @ 2009-01-15 9:50 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from edwintorok at gmail dot com 2009-01-15 09:50 -------
(In reply to comment #1)
> This is the frame-pointer setup code. You can get the same code as x86_64 with
> -momit-leaf-frame-pointer.
>
Ok. But can't the optimizers see that you push ebp, write something to it, and
then pop to it again, and remove that code automatically?
At least the movl is a dead store ...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38854
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug rtl-optimization/38854] missed optimization with -m32: empty functions shouldn't contain push/mov/pop
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
4 siblings, 0 replies; 6+ messages in thread
From: edwintorok at gmail dot com @ 2009-01-15 9:51 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from edwintorok at gmail dot com 2009-01-15 09:51 -------
(In reply to comment #2)
> (In reply to comment #1)
> > This is the frame-pointer setup code. You can get the same code as x86_64 with
> > -momit-leaf-frame-pointer.
> >
>
> Ok. But can't the optimizers see that you push ebp, write something to it, and
> then pop to it again, and remove that code automatically?
> At least the movl is a dead store ...
>
Or is the prologue/epilogue code special, and not run through such
optimizations?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38854
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug rtl-optimization/38854] missed optimization with -m32: empty functions shouldn't contain push/mov/pop
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
` (2 preceding siblings ...)
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
4 siblings, 0 replies; 6+ messages in thread
From: steven at gcc dot gnu dot org @ 2009-01-15 11:15 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from steven at gcc dot gnu dot org 2009-01-15 11:15 -------
Re. #3
Yes, the pro/epilogues are special.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38854
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug rtl-optimization/38854] missed optimization with -m32: empty functions shouldn't contain push/mov/pop
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
` (3 preceding siblings ...)
2009-01-15 11:15 ` steven at gcc dot gnu dot org
@ 2009-01-15 14:37 ` rguenth at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-01-15 14:37 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from rguenth at gcc dot gnu dot org 2009-01-15 14:37 -------
IMHO it's unwanted to remove the frame setup for empty functions without
-momit-leaf-frame-pointer. Debuggers may need it to do backtraces from
within that function.
--
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).