[Bug target/83031] New: Tail call optimization not used in cases when first part of the result is returned from function
antoshkka at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Nov 17 11:03:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83031
Bug ID: 83031
Summary: Tail call optimization not used in cases when first
part of the result is returned from function
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: antoshkka at gmail dot com
Target Milestone: ---
Following code:
struct ts {int a, b; };
ts foo();
int testing1() {
return foo().a;
}
Produces suboptimal assembly:
testing1():
sub rsp, 8
call foo()
add rsp, 8
ret
More optimal would be the following assembly:
testing1():
jmp foo() <== `a` is already in eax
More information about the Gcc-bugs
mailing list