public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/30288]  New: tail call with additional arguments
@ 2006-12-24 23:08 tkoenig at gcc dot gnu dot org
  2006-12-25  2:38 ` [Bug target/30288] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2006-12-24 23:08 UTC (permalink / raw)
  To: gcc-bugs

This tail call could be optimized:  Just
push the final 0, then jump.

$ cat tail.c
int foo (int, int);

int bar (int i)
{
  return foo (i, 0);
}
$ gcc -fomit-frame-pointer -S -O3  tail.c
$ cat tail.s
        .file   "tail.c"
        .text
        .p2align 4,,15
.globl bar
        .type   bar, @function
bar:
        subl    $12, %esp
        movl    16(%esp), %eax
        movl    $0, 4(%esp)
        movl    %eax, (%esp)
        call    foo
        addl    $12, %esp
        ret
        .size   bar, .-bar
        .ident  "GCC: (GNU) 4.3.0 20061211 (experimental)"
        .section        .note.GNU-stack,"",@progbits


-- 
           Summary: tail call with additional arguments
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tkoenig at gcc dot gnu dot org


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


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

* [Bug target/30288] tail call with additional arguments
  2006-12-24 23:08 [Bug tree-optimization/30288] New: tail call with additional arguments tkoenig at gcc dot gnu dot org
@ 2006-12-25  2:38 ` pinskia at gcc dot gnu dot org
  2006-12-25  2:40 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-12-25  2:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-12-25 02:38 -------
This is a target specific issue because it works correctly on ppc where you
pass via registers.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|tree-optimization           |target
 GCC target triplet|                            |i?86-*-*


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


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

* [Bug target/30288] tail call with additional arguments
  2006-12-24 23:08 [Bug tree-optimization/30288] New: tail call with additional arguments tkoenig at gcc dot gnu dot org
  2006-12-25  2:38 ` [Bug target/30288] " pinskia at gcc dot gnu dot org
@ 2006-12-25  2:40 ` pinskia at gcc dot gnu dot org
  2006-12-27  2:34 ` pinskia at gcc dot gnu dot org
  2007-01-07  0:59 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-12-25  2:40 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


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


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

* [Bug target/30288] tail call with additional arguments
  2006-12-24 23:08 [Bug tree-optimization/30288] New: tail call with additional arguments tkoenig at gcc dot gnu dot org
  2006-12-25  2:38 ` [Bug target/30288] " pinskia at gcc dot gnu dot org
  2006-12-25  2:40 ` pinskia at gcc dot gnu dot org
@ 2006-12-27  2:34 ` pinskia at gcc dot gnu dot org
  2007-01-07  0:59 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-12-27  2:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-12-27 02:34 -------
Just to show this works in general, here is the result for powerpc-darwin:
_bar:
        li r4,0
        b _foo


Also I don't think push will work as it can cause the stack to become
unaligned.


-- 


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


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

* [Bug target/30288] tail call with additional arguments
  2006-12-24 23:08 [Bug tree-optimization/30288] New: tail call with additional arguments tkoenig at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2006-12-27  2:34 ` pinskia at gcc dot gnu dot org
@ 2007-01-07  0:59 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-01-07  0:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2007-01-07 00:58 -------
Confirmed, a x86 only issue.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-01-07 00:58:54
               date|                            |


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


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

end of thread, other threads:[~2007-01-07  0:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-24 23:08 [Bug tree-optimization/30288] New: tail call with additional arguments tkoenig at gcc dot gnu dot org
2006-12-25  2:38 ` [Bug target/30288] " pinskia at gcc dot gnu dot org
2006-12-25  2:40 ` pinskia at gcc dot gnu dot org
2006-12-27  2:34 ` pinskia at gcc dot gnu dot org
2007-01-07  0:59 ` 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).