https://bugs.llvm.org/show_bug.cgi?id=46126
Bug ID: 46126
Summary: Failure to optimize tail call to jump when a pointer
to a variable that dies before the tail call is passed
to an external function
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedb...@nondot.org
Reporter: gabrav...@gmail.com
CC: llvm-bugs@lists.llvm.org
void external_function();
void takes_ptr(int *);
void f()
{
{
int x;
takes_ptr(&x);
}
external_function();
}
With -O3, LLVM produces this :
f(): # @f()
push rax
lea rdi, [rsp + 4]
call takes_ptr(int*)
call external_function()
pop rax
ret
GCC produces this :
f():
sub rsp, 24
lea rdi, [rsp+12]
call takes_ptr(int*)
add rsp, 24
jmp external_function()
Since `x` dies before `external_function` is called, there is no possibility
that `external_function` may depend on `x` still being alive (which I presume
is why GCC does not do this optimization when `x` is still alive by the time
`external_function` is called)
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs