aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSteve Ellcey <sje@cup.hp.com>2009-02-13 21:59:32 +0000
committerSteve Ellcey <sje@gcc.gnu.org>2009-02-13 21:59:32 +0000
commitc208436c7bef0b3d4aa15073347404b9178e9280 (patch)
tree2badc0d5087fc55bf5e504f84afe8003555ac6d1 /gcc
parent686c82b505d95d57302821df084c751b9528cea7 (diff)
downloadgcc-c208436c7bef0b3d4aa15073347404b9178e9280.zip
gcc-c208436c7bef0b3d4aa15073347404b9178e9280.tar.gz
gcc-c208436c7bef0b3d4aa15073347404b9178e9280.tar.bz2
re PR target/38056 (Missed tail calls on ia64)
PR target/38056 * config/ia64/ia64.c (ia64_function_ok_for_sibcall): Check TARGET_CONST_GP. * gcc.target/ia64/sibcall-opt-1.c: New test. * gcc.target/ia64/sibcall-opt-2.c: New test. From-SVN: r144168
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/ia64/ia64.c5
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.target/ia64/sibcall-opt-1.c12
-rw-r--r--gcc/testsuite/gcc.target/ia64/sibcall-opt-2.c12
5 files changed, 39 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5f8aac0..f4b29ef 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2009-02-13 Steve Ellcey <sje@cup.hp.com>
+
+ PR target/38056
+ * config/ia64/ia64.c (ia64_function_ok_for_sibcall): Check
+ TARGET_CONST_GP.
+
2009-02-13 H.J. Lu <hongjiu.lu@intel.com>
PR target/39149
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index 6c28801..495d943 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -4365,8 +4365,9 @@ ia64_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED)
return false;
/* We must always return with our current GP. This means we can
- only sibcall to functions defined in the current module. */
- return decl && (*targetm.binds_local_p) (decl);
+ only sibcall to functions defined in the current module unless
+ TARGET_CONST_GP is set to true. */
+ return (decl && (*targetm.binds_local_p) (decl)) || TARGET_CONST_GP;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a0f1650..ca7aece7 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2009-02-13 Steve Ellcey <sje@cup.hp.com>
+
+ PR target/38056
+ * gcc.target/ia64/sibcall-opt-1.c: New test.
+ * gcc.target/ia64/sibcall-opt-2.c: New test.
+
2009-02-13 Paul Thomas <pault@gcc.gnu.org>
PR fortran/36528
diff --git a/gcc/testsuite/gcc.target/ia64/sibcall-opt-1.c b/gcc/testsuite/gcc.target/ia64/sibcall-opt-1.c
new file mode 100644
index 0000000..6e8d1a2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/ia64/sibcall-opt-1.c
@@ -0,0 +1,12 @@
+/* PR target/38056. Do not do sibcall optimization across object file
+ boundery when -mconstant-gp is not used. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler "br.call.*bar" } } */
+
+int bar(int x);
+
+int foo(int x)
+{
+ return (bar(x + 1));
+}
diff --git a/gcc/testsuite/gcc.target/ia64/sibcall-opt-2.c b/gcc/testsuite/gcc.target/ia64/sibcall-opt-2.c
new file mode 100644
index 0000000..d802b79
--- /dev/null
+++ b/gcc/testsuite/gcc.target/ia64/sibcall-opt-2.c
@@ -0,0 +1,12 @@
+/* PR target/38056. Do sibcall optimization across object file
+ boundery when -mconstant-gp is used. */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mconstant-gp" } */
+/* { dg-final { scan-assembler-not "br.call.*bar" } } */
+
+int bar(int x);
+
+int foo(int x)
+{
+ return (bar(x + 1));
+}