public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/54360] New: missed optimalization: unnecessary indirect call
@ 2012-08-23 14:52 neleai at seznam dot cz
2012-08-23 15:00 ` [Bug c/54360] " jakub at gcc dot gnu.org
2012-09-03 9:53 ` [Bug c/54360] missed optimization: " rguenth at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: neleai at seznam dot cz @ 2012-08-23 14:52 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54360
Bug #: 54360
Summary: missed optimalization: unnecessary indirect call
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: neleai@seznam.cz
Consider following program:
void bar(int *x);
int x(){
struct {
void (*b)(int *);
int a;
} foo;
foo.b=bar;
foo.b(&(foo.a));
foo.b(&(foo.a));
}
int y(){
void (*b)(int *);
int a;
b=bar;
b(&a);
b(&a);
}
In function x gcc eliminaties first indirect call but not second. In y both
calls are eliminated.
.file "s.c"
.text
.p2align 4,,15
.globl x
.type x, @function
x:
.LFB0:
.cfi_startproc
subq $24, %rsp
.cfi_def_cfa_offset 32
leaq 8(%rsp), %rdi
movq $bar, (%rsp)
call bar
leaq 8(%rsp), %rdi
call *(%rsp)
addq $24, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE0:
.size x, .-x
.p2align 4,,15
.globl y
.type y, @function
y:
.LFB1:
.cfi_startproc
subq $24, %rsp
.cfi_def_cfa_offset 32
leaq 12(%rsp), %rdi
call bar
leaq 12(%rsp), %rdi
call bar
addq $24, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE1:
.size y, .-y
.ident "GCC: (Debian 20120820-1) 4.8.0 20120820 (experimental) [trunk
revision 190537]"
.section .note.GNU-stack,"",@progbits
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-09-03 9:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-23 14:52 [Bug c/54360] New: missed optimalization: unnecessary indirect call neleai at seznam dot cz
2012-08-23 15:00 ` [Bug c/54360] " jakub at gcc dot gnu.org
2012-09-03 9:53 ` [Bug c/54360] missed optimization: " rguenth at gcc dot gnu.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).