This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: cleanup leftover non-local variable checks
- From: Richard Henderson <rth at redhat dot com>
- To: Ulrich Weigand <weigand at i1 dot informatik dot uni-erlangen dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 10 Aug 2004 20:57:29 -0700
- Subject: Re: cleanup leftover non-local variable checks
- References: <200408051337.PAA01888@faui1m.informatik.uni-erlangen.de>
On Thu, Aug 05, 2004 at 03:37:15PM +0200, Ulrich Weigand wrote:
> This apparently has the effect of disabling tail calls in any
> function that uses any (non-static) global variable; e.g.
> dwarf2_name in dwarf2out.c no longer uses a tail call.
Fixed.
r~
* tree-tailcall.c (suitable_for_tail_opt_p): Also check DECL_EXTERNAL.
Index: tree-tailcall.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-tailcall.c,v
retrieving revision 2.20
diff -c -p -d -u -r2.20 tree-tailcall.c
--- tree-tailcall.c 5 Aug 2004 08:41:57 -0000 2.20
+++ tree-tailcall.c 11 Aug 2004 03:55:41 -0000
@@ -143,7 +143,7 @@ suitable_for_tail_opt_p (void)
{
tree var = VARRAY_TREE (referenced_vars, i);
- if (!TREE_STATIC (var)
+ if (!(TREE_STATIC (var) || DECL_EXTERNAL (var))
&& var_ann (var)->mem_tag_kind == NOT_A_TAG
&& is_call_clobbered (var))
return false;