From: Jakub Jelinek Date: Mon, 5 Mar 2018 16:24:43 +0000 (+0100) Subject: re PR target/84564 (error: unable to find a register to spill with -mforce-indirect... X-Git-Tag: upstream/12.2.0~33033 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=537400180d36469bf97daeb28d23161fe9ed022a;p=platform%2Fupstream%2Fgcc.git re PR target/84564 (error: unable to find a register to spill with -mforce-indirect-call) PR target/84564 * config/i386/i386.c (ix86_function_ok_for_sibcall): Check for regparm >= 3 with no arg reg available also for calls with flag_force_indirect_call. Pass decl to ix86_function_regparm. * gcc.target/i386/pr84564.c: New test. From-SVN: r258256 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ef9a8c9..1d1ef6e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2018-03-05 Jakub Jelinek + PR target/84564 + * config/i386/i386.c (ix86_function_ok_for_sibcall): Check for + regparm >= 3 with no arg reg available also for calls with + flag_force_indirect_call. Pass decl to ix86_function_regparm. + PR target/84524 * config/i386/sse.md (*3): Replace with orig,vex. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 9cdc96f..e352303 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -6415,7 +6415,8 @@ ix86_function_ok_for_sibcall (tree decl, tree exp) function via GOT slot are indirect. */ if (!decl || (bind_global && flag_pic && !flag_plt) - || (TARGET_DLLIMPORT_DECL_ATTRIBUTES && DECL_DLLIMPORT_P (decl))) + || (TARGET_DLLIMPORT_DECL_ATTRIBUTES && DECL_DLLIMPORT_P (decl)) + || flag_force_indirect_call) { /* Check if regparm >= 3 since arg_reg_available is set to false if regparm == 0. If regparm is 1 or 2, there is @@ -6424,7 +6425,7 @@ ix86_function_ok_for_sibcall (tree decl, tree exp) ??? The symbol indirect call doesn't need a call-clobbered register. But we don't know if this is a symbol indirect call or not here. */ - if (ix86_function_regparm (type, NULL) >= 3 + if (ix86_function_regparm (type, decl) >= 3 && !cfun->machine->arg_reg_available) return false; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a1f72cb..e80a728 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-03-05 Jakub Jelinek + + PR target/84564 + * gcc.target/i386/pr84564.c: New test. + 2018-03-05 Marek Polacek PR c++/84707 @@ -4234,7 +4239,7 @@ PR fortran/84141 PR fortran/84155 - * gfortran.dg/pr84155.f90 : New test. + * gfortran.dg/pr84155.f90: New test. 2017-02-02 Uros Bizjak @@ -4493,7 +4498,7 @@ 2018-01-31 Paul Thomas PR fortran/84088 - * gfortran.dg/pr84088.f90 : New test. + * gfortran.dg/pr84088.f90: New test. 2018-01-31 Vladimir Makarov diff --git a/gcc/testsuite/gcc.target/i386/pr84564.c b/gcc/testsuite/gcc.target/i386/pr84564.c new file mode 100644 index 0000000..f311ebd --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr84564.c @@ -0,0 +1,21 @@ +/* PR target/84564 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -mforce-indirect-call" } */ + +int a, b, c, d; +int foo (void); + +static int +bar (int x, int y, int z) +{ + while (a) + if (foo ()) + bar (x, y, z); + return 0; +} + +int +baz (void) +{ + return bar (b, c, d); +}