This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/61605] New: Potential optimization: Keep unclobbered argument registers live across function calls
- From: "patrick at parcs dot ath.cx" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 25 Jun 2014 11:39:52 +0000
- Subject: [Bug rtl-optimization/61605] New: Potential optimization: Keep unclobbered argument registers live across function calls
- Auto-submitted: auto-generated
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