aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2005-08-11 08:59:22 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2005-08-11 08:59:22 +0000
commitcac329963a81d95f7f04ece46bbc07786e954e40 (patch)
tree93dfba666e9c452b502c85b38462c19758950a9a /gcc
parentbdea5c0eadb0ae0a825709fff5893360b326b861 (diff)
downloadgcc-cac329963a81d95f7f04ece46bbc07786e954e40.zip
gcc-cac329963a81d95f7f04ece46bbc07786e954e40.tar.gz
gcc-cac329963a81d95f7f04ece46bbc07786e954e40.tar.bz2
re PR target/23289 (tail call optimization not performed)
2005-08-11 Richard Guenther <rguenther@suse.de> PR target/23289 * config/i386/i386.c (ix86_function_ok_for_sibcall): Handle cases where we call to/from functions returning void. * gcc.target/i386/tailcall-1.c: New testcase. From-SVN: r102981
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/i386/i386.c12
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/i386/tailcall-1.c27
4 files changed, 48 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2c09505..a6715d0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2005-08-11 Richard Guenther <rguenther@suse.de>
+
+ PR target/23289
+ * config/i386/i386.c (ix86_function_ok_for_sibcall): Handle
+ cases where we call to/from functions returning void.
+
2005-08-10 James A. Morrison <phython@gcc.gnu.org>
PR c++/23225
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 68589b2..3c62bf0 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -1907,6 +1907,7 @@ ix86_function_ok_for_sibcall (tree decl, tree exp)
{
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,
@@ -1929,11 +1930,18 @@ ix86_function_ok_for_sibcall (tree decl, tree exp)
function that does or, conversely, from a function that does return
a float to a function that doesn't; the necessary stack adjustment
would not be executed. This is also the place we notice
- differences in the return value ABI. */
+ differences in the return value ABI. Note that it is ok for one
+ of the functions to have void return type as long as the return
+ value of the other is passed in a register. */
a = ix86_function_value (TREE_TYPE (exp), func, false);
b = ix86_function_value (TREE_TYPE (DECL_RESULT (cfun->decl)),
cfun->decl, false);
- if (! rtx_equal_p (a, b))
+ 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))
return false;
/* If this call is indirect, we'll need to be able to use a call-clobbered
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index dd74474..8a29628 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2005-08-11 Richard Guenther <rguenther@suse.de>
+
+ PR target/23289
+ * gcc.target/i386/tailcall-1.c: New testcase.
+
2005-08-10 James A. Morrison <phython@gc.gnu.org>
* gcc.dg/vect/vect-67.c: Un-xfail.
diff --git a/gcc/testsuite/gcc.target/i386/tailcall-1.c b/gcc/testsuite/gcc.target/i386/tailcall-1.c
new file mode 100644
index 0000000..b916b6c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/tailcall-1.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+typedef unsigned int Cardinal;
+typedef char *String;
+typedef struct _WidgetRec *Widget;
+
+typedef union _XEvent {
+ int type;
+ long pad[24];
+} XEvent;
+
+
+extern int SendMousePosition (Widget w, XEvent* event);
+
+
+void
+HandleIgnore(Widget w,
+ XEvent * event,
+ String * params ,
+ Cardinal *param_count )
+{
+
+ (void) SendMousePosition(w, event);
+}
+
+/* { dg-final { scan-assembler "jmp" } } */