summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@gcc.gnu.org>2013-10-15 18:24:30 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2013-10-15 18:24:30 +0000
commit1602204161a775e9d03057565b85cfbcbd5f29c9 (patch)
tree2fb3dd6d894f00d9fff1ba8e8fc2b73c2cc737f8
parentb114bfb45570c08000ad34110337641a7021727f (diff)
tree-tailcall.c (find_tail_calls): Don't use tail-call recursion for built-in functions.
gcc/ 2013-10-15 Richard Biener <rguenther@suse.de> * tree-tailcall.c (find_tail_calls): Don't use tail-call recursion for built-in functions. gcc/testsuite/ * gcc.dg/torture/builtin-self.c: New file. libgcc/ * sync.c: Remove static aliases and define each function directly under its real name. From-SVN: r203628
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/torture/builtin-self.c10
-rw-r--r--gcc/tree-tailcall.c4
-rw-r--r--libgcc/ChangeLog5
-rw-r--r--libgcc/sync.c29
6 files changed, 39 insertions, 18 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index dd10a5fc866..c3c209d13b2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2013-10-15 Richard Biener <rguenther@suse.de>
+
+ * tree-tailcall.c (find_tail_calls): Don't use tail-call recursion
+ for built-in functions.
+
2013-10-15 Zhenqiang Chen <zhenqiang.chen@arm.com>
* tree-ssa-reassoc.c: Include rtl.h and tm_p.h.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d59cc4f5ad7..11099e190b1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2013-10-15 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * gcc.dg/torture/builtin-self.c: New file.
+
2013-10-15 Zhenqiang Chen <zhenqiang.chen@arm.com>
* gcc.dg/tree-ssa/reassoc-32.c: New test case.
diff --git a/gcc/testsuite/gcc.dg/torture/builtin-self.c b/gcc/testsuite/gcc.dg/torture/builtin-self.c
new file mode 100644
index 00000000000..6d1719f7517
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/builtin-self.c
@@ -0,0 +1,10 @@
+/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
+/* Check that we can use this idiom to define out-of-line copies of built-in
+ functions. This is used by libgcc/sync.c, for example. */
+void __sync_synchronize (void)
+{
+ __sync_synchronize ();
+}
+/* { dg-final { scan-assembler "__sync_synchronize" } } */
+/* { dg-final { scan-assembler "\t(lock|mfence)" } } */
+/* { dg-final { scan-assembler-not "\tcall" } } */
diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c
index 721c8314b4a..415d19acbbb 100644
--- a/gcc/tree-tailcall.c
+++ b/gcc/tree-tailcall.c
@@ -446,7 +446,9 @@ find_tail_calls (basic_block bb, struct tailcall **ret)
/* We found the call, check whether it is suitable. */
tail_recursion = false;
func = gimple_call_fndecl (call);
- if (func && recursive_call_p (current_function_decl, func))
+ if (func
+ && !DECL_BUILT_IN (func)
+ && recursive_call_p (current_function_decl, func))
{
tree arg;
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index 40fcdba3c76..867155a24d5 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,8 @@
+2013-10-15 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * sync.c: Remove static aliases and define each function directly
+ under its real name.
+
2013-10-02 John David Anglin <danglin@gcc.gnu.org>
* config.host (hppa*64*-*-linux*): Define extra_parts.
diff --git a/libgcc/sync.c b/libgcc/sync.c
index edb985eae26..17158c90217 100644
--- a/libgcc/sync.c
+++ b/libgcc/sync.c
@@ -67,27 +67,26 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#if defined FN
-/* Define macros for each __sync_* function type. Each macro defines a
- local function called <NAME>_<UNITS> that acts like __<NAME>_<UNITS>.
- TYPE is a type that has UNITS bytes. */
+/* Define functions called __sync_<NAME>_<UNITS>, with one macro per
+ signature. TYPE is a type that has UNITS bytes. */
#define DEFINE_V_PV(NAME, UNITS, TYPE) \
- static TYPE \
- NAME##_##UNITS (TYPE *ptr, TYPE value) \
+ TYPE \
+ __##NAME##_##UNITS (TYPE *ptr, TYPE value) \
{ \
return __##NAME (ptr, value); \
}
-#define DEFINE_V_PVV(NAME, UNITS, TYPE) \
- static TYPE \
- NAME##_##UNITS (TYPE *ptr, TYPE value1, TYPE value2) \
+#define DEFINE_V_PVV(NAME, UNITS, TYPE) \
+ TYPE \
+ __##NAME##_##UNITS (TYPE *ptr, TYPE value1, TYPE value2) \
{ \
return __##NAME (ptr, value1, value2); \
}
#define DEFINE_BOOL_PVV(NAME, UNITS, TYPE) \
- static _Bool \
- NAME##_##UNITS (TYPE *ptr, TYPE value1, TYPE value2) \
+ _Bool \
+ __##NAME##_##UNITS (TYPE *ptr, TYPE value1, TYPE value2) \
{ \
return __##NAME (ptr, value1, value2); \
}
@@ -118,9 +117,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define DEFINE1(NAME, UNITS, TYPE) \
static int unused[sizeof (TYPE) == UNITS ? 1 : -1] \
__attribute__((unused)); \
- local_##NAME (NAME, UNITS, TYPE); \
- typeof (NAME##_##UNITS) __##NAME##_##UNITS \
- __attribute__((alias (#NAME "_" #UNITS)));
+ local_##NAME (NAME, UNITS, TYPE);
/* As above, but performing macro expansion on the arguments. */
#define DEFINE(NAME, UNITS, TYPE) DEFINE1 (NAME, UNITS, TYPE)
@@ -167,13 +164,11 @@ DEFINE (FN, 8, UOItype)
#if defined Lsync_synchronize
-static void
-sync_synchronize (void)
+void
+__sync_synchronize (void)
{
__sync_synchronize ();
}
-typeof (sync_synchronize) __sync_synchronize \
- __attribute__((alias ("sync_synchronize")));
#endif