public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/11830] New: Unnecessary call to an empty function
@ 2003-08-06  9:26 alga at rgai dot hu
  2003-08-06 12:08 ` [Bug optimization/11830] " pinskia at physics dot uc dot edu
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: alga at rgai dot hu @ 2003-08-06  9:26 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: Unnecessary call to an empty function
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: alga at rgai dot hu
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: arm-unknown-elf

If a (non-virtual) function doesn't have any instructions or the caller
function(s) are not dependent on the result of the called function
(which is hard to identify), then the function call instruction is
unnecessary at the caller.
The unit-at-a-time algorithm doesn't solve this problem either.

--- c example ---
int a,b;
int get(int i)
{
  return i;
}
void foo()
{
  a=10;
  b=get(a);
}

--- arm code ---
get:
 mov pc, lr <- RETURN
foo:
 ldr r2, .L3
 mov r3, #10
 mov ip, sp
 stmfd sp!, {fp, ip, lr, pc}
 mov r0, r3
 str r3, [r2, #0]
 sub fp, ip, #4
 bl get <- OLD
 ldr r3, .L3+4
 str r0, [r3, #0]
 ldmea fp, {fp, sp, pc} 

--- possible solution ---
get:
 mov pc, lr <- RETURN
foo:
 ldr r2, .L3
 mov r3, #10
 mov ip, sp
 stmfd sp!, {fp, ip, lr, pc}
 mov r0, r3
 str r3, [r2, #0]
 sub fp, ip, #4
 ldr r3, .L3+4
 str r0, [r3, #0]
 ldmea fp, {fp, sp, pc}


^ permalink raw reply	[flat|nested] 9+ messages in thread
[parent not found: <20030806092603.11830.loki@inf.u-szeged.hu>]

end of thread, other threads:[~2004-04-03  1:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-06  9:26 [Bug optimization/11830] New: Unnecessary call to an empty function alga at rgai dot hu
2003-08-06 12:08 ` [Bug optimization/11830] " pinskia at physics dot uc dot edu
2003-08-06 12:49 ` rearnsha at arm dot com
2003-08-06 13:06 ` pinskia at physics dot uc dot edu
2003-08-15  3:41 ` pinskia at gcc dot gnu dot org
2003-10-26 20:32 ` pinskia at gcc dot gnu dot org
2003-11-05 13:19 ` alga at rgai dot hu
2003-11-13  8:43 ` alga at rgai dot hu
     [not found] <20030806092603.11830.loki@inf.u-szeged.hu>
2004-04-03  1:11 ` pinskia 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).