re PR target/65753 ([i386] Incorrect tail call inhibition logic on i386 (32-bit))

PR target/65753
	* config/i386/i386.c (ix86_function_ok_for_sibcall): Allow PIC sibcalls
	via function pointers.

testsuite:
	* gcc.target/i386/pr65753.c: New test.

From-SVN: r223005
This commit is contained in:
Alexander Monakov 2015-05-11 19:10:24 +03:00 committed by Alexander Monakov
parent b91fd3c76a
commit f1ed9790a3
4 changed files with 22 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2015-05-11 Alexander Monakov <amonakov@ispras.ru>
PR target/65753
* config/i386/i386.c (ix86_function_ok_for_sibcall): Allow PIC sibcalls
via function pointers.
2015-05-11 Alexander Monakov <amonakov@ispras.ru>
* calls.c (prepare_call_address): Transform PLT call to GOT lookup and

View File

@ -5473,12 +5473,12 @@ ix86_function_ok_for_sibcall (tree decl, tree exp)
rtx a, b;
/* If we are generating position-independent code, we cannot sibcall
optimize any indirect call, or a direct call to a global function,
as the PLT requires %ebx be live. (Darwin does not have a PLT.) */
optimize direct calls to global functions, as the PLT requires
%ebx be live. (Darwin does not have a PLT.) */
if (!TARGET_MACHO
&& !TARGET_64BIT
&& flag_pic
&& (!decl || !targetm.binds_local_p (decl)))
&& decl && !targetm.binds_local_p (decl))
return false;
/* If we need to align the outgoing stack, then sibcalling would

View File

@ -1,3 +1,8 @@
2015-05-11 Alexander Monakov <amonakov@ispras.ru>
PR target/65753
* gcc.target/i386/pr65753.c: New test.
2015-05-11 Richard Sandiford <richard.sandiford@arm.com>
PR rtl-optimization/66076

View File

@ -0,0 +1,8 @@
/* { dg-do compile } */
/* { dg-options "-fPIC -O" } */
/* { dg-final { scan-assembler-not "call" } } */
void foo(void (*bar)(void))
{
bar();
}