@@ -6411,7 +6411,8 @@ ix86_function_ok_for_sibcall (tree decl,
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
@@ -6420,7 +6421,7 @@ ix86_function_ok_for_sibcall (tree decl,
??? 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;
}
@@ -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);
+}