This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
fix i387 sibcalls
- From: Richard Henderson <rth at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Richard Guenther <rguenther at suse dot de>
- Date: Wed, 31 Aug 2005 09:21:36 -0700
- Subject: fix i387 sibcalls
The patch for PR23289 was incorrect for functions touching the floating
point stack. This was caught by adding a verify_flow_info call at the
end of fixup_abnormal_edges; we emitted stack fixup code after the
tail call.
Tested on i386 and x86_64 linux.
r~
* config/i386/i386.c (ix86_function_ok_for_sibcall): Fix test for
fp return matching.
Index: config/i386/i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.854
diff -u -p -d -r1.854 i386.c
--- config/i386/i386.c 30 Aug 2005 07:32:32 -0000 1.854
+++ config/i386/i386.c 31 Aug 2005 16:13:40 -0000
@@ -1907,7 +1907,6 @@ ix86_function_ok_for_sibcall (tree decl,
{
tree func;
rtx a, b;
- bool one_void, one_reg;
/* If we are generating position-independent code, we cannot sibcall
optimize any indirect call, or a direct call to a global function,
@@ -1936,12 +1935,14 @@ ix86_function_ok_for_sibcall (tree decl,
a = ix86_function_value (TREE_TYPE (exp), func, false);
b = ix86_function_value (TREE_TYPE (DECL_RESULT (cfun->decl)),
cfun->decl, false);
- one_void = (VOID_TYPE_P (TREE_TYPE (exp))
- || VOID_TYPE_P (TREE_TYPE (DECL_RESULT (cfun->decl))));
- one_reg = ((REG_P (a) && !STACK_REG_P (a))
- || (REG_P (b) && !STACK_REG_P (b)));
- if (!(one_void && one_reg)
- && !rtx_equal_p (a, b))
+ if (STACK_REG_P (a) || STACK_REG_P (b))
+ {
+ if (!rtx_equal_p (a, b))
+ return false;
+ }
+ else if (VOID_TYPE_P (TREE_TYPE (DECL_RESULT (cfun->decl))))
+ ;
+ else if (!rtx_equal_p (a, b))
return false;
/* If this call is indirect, we'll need to be able to use a call-clobbered