public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/61605] New: Potential optimization: Keep unclobbered argument registers live across function calls
@ 2014-06-25 11:39 patrick at parcs dot ath.cx
  2014-09-28  7:15 ` [Bug rtl-optimization/61605] " andi-gcc at firstfloor dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: patrick at parcs dot ath.cx @ 2014-06-25 11:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61605

            Bug ID: 61605
           Summary: Potential optimization: Keep unclobbered argument
                    registers live across function calls
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: patrick at parcs dot ath.cx

If a function is known to not clobber an argument register then the caller
shouldn't have to save/reload that register across the function call.  Example:

The C code:

static int __attribute__ ((noinline))
bar (int x)
{
  return x + 3;
}

int
foo (int y)
{
  return y + bar (y);
}

generates:

bar:
.LFB0:
        .cfi_startproc
        leal    3(%rdi), %eax
        ret
        .cfi_endproc
foo:
.LFB1:
        .cfi_startproc
        movl    %edi, %edx
        call    bar
        addl    %edx, %eax
        ret
        .cfi_endproc

Here, %edi is saved to %edx even though the call to bar doesn't clobber %edi. 
The assembly for the function foo could potentially be:

        call    bar
        addl    %edi, %eax


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

end of thread, other threads:[~2014-10-17  6:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-25 11:39 [Bug rtl-optimization/61605] New: Potential optimization: Keep unclobbered argument registers live across function calls patrick at parcs dot ath.cx
2014-09-28  7:15 ` [Bug rtl-optimization/61605] " andi-gcc at firstfloor dot org
2014-09-28  7:22 ` pinskia at gcc dot gnu.org
2014-09-28  7:36 ` andi-gcc at firstfloor dot org
2014-09-29 10:24 ` vries at gcc dot gnu.org
2014-09-30 10:25 ` vries at gcc dot gnu.org
2014-09-30 10:29 ` vries at gcc dot gnu.org
2014-10-16  9:16 ` vries at gcc dot gnu.org
2014-10-17  6:37 ` vries at gcc dot gnu.org
2014-10-17  6:37 ` vries 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).