[Bug optimization/14312] [tree-ssa] [regression] tailcalls not being generated when functions contain pointers
dnovillo at redhat dot com
gcc-bugzilla@gcc.gnu.org
Fri Feb 27 13:16:00 GMT 2004
------- Additional Comments From dnovillo at redhat dot com 2004-02-27 13:16 -------
Subject: Re: [tree-ssa] [regression] tailcalls not
being generated when functions contain pointers
On Fri, 2004-02-27 at 07:38, rth at gcc dot gnu dot org wrote:
> Will you please invent a way to recoginize them and ignore them in
> suitable_for_tail_opt_p?
>
There's nothing to invent, really. suitable_for_tail_opt_p was doing a
very weak test. It should really test whether the local variable is
call-clobbered, which is computed using escape analysis.
We ought to check other places in the optimizers where we use
addressability instead of is_call_clobbered.
Fixed with this patch. Will commit if testing doesn't show any
regressions.
Diego.
PR optimization/14312
* tree-tailcall.c (suitable_for_tail_opt_p): Call
is_call_clobbered instead of checking addressability.
Index: tree-tailcall.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-tailcall.c,v
retrieving revision 1.1.2.19
diff -d -c -p -r1.1.2.19 tree-tailcall.c
*** tree-tailcall.c 25 Feb 2004 03:22:47 -0000 1.1.2.19
--- tree-tailcall.c 27 Feb 2004 13:14:14 -0000
*************** suitable_for_tail_opt_p (void)
*** 72,87 ****
if (current_function_stdarg)
return false;
! /* No local variable should have its address taken, as otherwise it might
! be passed to the recursive call. This of course is overly
! conservative and should be replaced by a dataflow analysis later. */
for (i = 0; i < (int) VARRAY_ACTIVE_SIZE (referenced_vars); i++)
{
tree var = VARRAY_TREE (referenced_vars, i);
if (decl_function_context (var) == current_function_decl
! && !TREE_STATIC (var)
! && TREE_ADDRESSABLE (var))
return false;
}
--- 72,86 ----
if (current_function_stdarg)
return false;
! /* No local variable should be call-clobbered. We ignore any kind
! of memory tag, as these are not real variables. */
for (i = 0; i < (int) VARRAY_ACTIVE_SIZE (referenced_vars); i++)
{
tree var = VARRAY_TREE (referenced_vars, i);
if (decl_function_context (var) == current_function_decl
! && var_ann (var)->mem_tag_kind == NOT_A_TAG
! && is_call_clobbered (var))
return false;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14312
More information about the Gcc-bugs
mailing list