Commit 16022041 by Richard Sandiford

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
parent b114bfb4
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> 2013-10-15 Zhenqiang Chen <zhenqiang.chen@arm.com>
* tree-ssa-reassoc.c: Include rtl.h and tm_p.h. * tree-ssa-reassoc.c: Include rtl.h and tm_p.h.
......
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> 2013-10-15 Zhenqiang Chen <zhenqiang.chen@arm.com>
* gcc.dg/tree-ssa/reassoc-32.c: New test case. * gcc.dg/tree-ssa/reassoc-32.c: New test case.
......
/* { 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" } } */
...@@ -446,7 +446,9 @@ find_tail_calls (basic_block bb, struct tailcall **ret) ...@@ -446,7 +446,9 @@ find_tail_calls (basic_block bb, struct tailcall **ret)
/* We found the call, check whether it is suitable. */ /* We found the call, check whether it is suitable. */
tail_recursion = false; tail_recursion = false;
func = gimple_call_fndecl (call); 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; tree arg;
......
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> 2013-10-02 John David Anglin <danglin@gcc.gnu.org>
* config.host (hppa*64*-*-linux*): Define extra_parts. * config.host (hppa*64*-*-linux*): Define extra_parts.
......
...@@ -67,27 +67,26 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ...@@ -67,27 +67,26 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#if defined FN #if defined FN
/* Define macros for each __sync_* function type. Each macro defines a /* Define functions called __sync_<NAME>_<UNITS>, with one macro per
local function called <NAME>_<UNITS> that acts like __<NAME>_<UNITS>. signature. TYPE is a type that has UNITS bytes. */
TYPE is a type that has UNITS bytes. */
#define DEFINE_V_PV(NAME, UNITS, TYPE) \ #define DEFINE_V_PV(NAME, UNITS, TYPE) \
static TYPE \ TYPE \
NAME##_##UNITS (TYPE *ptr, TYPE value) \ __##NAME##_##UNITS (TYPE *ptr, TYPE value) \
{ \ { \
return __##NAME (ptr, value); \ return __##NAME (ptr, value); \
} }
#define DEFINE_V_PVV(NAME, UNITS, TYPE) \ #define DEFINE_V_PVV(NAME, UNITS, TYPE) \
static TYPE \ TYPE \
NAME##_##UNITS (TYPE *ptr, TYPE value1, TYPE value2) \ __##NAME##_##UNITS (TYPE *ptr, TYPE value1, TYPE value2) \
{ \ { \
return __##NAME (ptr, value1, value2); \ return __##NAME (ptr, value1, value2); \
} }
#define DEFINE_BOOL_PVV(NAME, UNITS, TYPE) \ #define DEFINE_BOOL_PVV(NAME, UNITS, TYPE) \
static _Bool \ _Bool \
NAME##_##UNITS (TYPE *ptr, TYPE value1, TYPE value2) \ __##NAME##_##UNITS (TYPE *ptr, TYPE value1, TYPE value2) \
{ \ { \
return __##NAME (ptr, value1, value2); \ return __##NAME (ptr, value1, value2); \
} }
...@@ -118,9 +117,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ...@@ -118,9 +117,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define DEFINE1(NAME, UNITS, TYPE) \ #define DEFINE1(NAME, UNITS, TYPE) \
static int unused[sizeof (TYPE) == UNITS ? 1 : -1] \ static int unused[sizeof (TYPE) == UNITS ? 1 : -1] \
__attribute__((unused)); \ __attribute__((unused)); \
local_##NAME (NAME, UNITS, TYPE); \ local_##NAME (NAME, UNITS, TYPE);
typeof (NAME##_##UNITS) __##NAME##_##UNITS \
__attribute__((alias (#NAME "_" #UNITS)));
/* As above, but performing macro expansion on the arguments. */ /* As above, but performing macro expansion on the arguments. */
#define DEFINE(NAME, UNITS, TYPE) DEFINE1 (NAME, UNITS, TYPE) #define DEFINE(NAME, UNITS, TYPE) DEFINE1 (NAME, UNITS, TYPE)
...@@ -167,13 +164,11 @@ DEFINE (FN, 8, UOItype) ...@@ -167,13 +164,11 @@ DEFINE (FN, 8, UOItype)
#if defined Lsync_synchronize #if defined Lsync_synchronize
static void void
sync_synchronize (void) __sync_synchronize (void)
{ {
__sync_synchronize (); __sync_synchronize ();
} }
typeof (sync_synchronize) __sync_synchronize \
__attribute__((alias ("sync_synchronize")));
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment