From: Alexander Monakov Date: Mon, 11 May 2015 16:10:24 +0000 (+0300) Subject: re PR target/65753 ([i386] Incorrect tail call inhibition logic on i386 (32-bit)) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f1ed9790a36ceff598fc2ad873a0bb7778c9fa6e;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 38f929bd19d..7640c5b50aa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-05-11 Alexander Monakov + + PR target/65753 + * config/i386/i386.c (ix86_function_ok_for_sibcall): Allow PIC sibcalls + via function pointers. + 2015-05-11 Alexander Monakov * calls.c (prepare_call_address): Transform PLT call to GOT lookup and diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 7bd9ff307b6..fb7977f4d65 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3b327b75b7f..e5fda8b9f3d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-05-11 Alexander Monakov + + PR target/65753 + * gcc.target/i386/pr65753.c: New test. + 2015-05-11 Richard Sandiford PR rtl-optimization/66076 diff --git a/gcc/testsuite/gcc.target/i386/pr65753.c b/gcc/testsuite/gcc.target/i386/pr65753.c new file mode 100644 index 00000000000..70061e2effb --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr65753.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-fPIC -O" } */ +/* { dg-final { scan-assembler-not "call" } } */ + +void foo(void (*bar)(void)) +{ + bar(); +}