public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dnovillo at redhat dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug optimization/14312] [tree-ssa] [regression] tailcalls not being generated when functions contain pointers
Date: Fri, 27 Feb 2004 13:16:00 -0000	[thread overview]
Message-ID: <20040227131638.15537.qmail@sources.redhat.com> (raw)
In-Reply-To: <20040227010444.14312.rearnsha@gcc.gnu.org>


------- 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


  parent reply	other threads:[~2004-02-27 13:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-27  1:04 [Bug optimization/14312] New: [tree-ssa regression] " rearnsha at gcc dot gnu dot org
2004-02-27  1:05 ` [Bug optimization/14312] " rearnsha at gcc dot gnu dot org
2004-02-27  2:01 ` [Bug optimization/14312] [tree-ssa] [regression] " pinskia at gcc dot gnu dot org
2004-02-27 12:38 ` rth at gcc dot gnu dot org
2004-02-27 13:16 ` dnovillo at redhat dot com [this message]
2004-02-27 18:39 ` cvs-commit at gcc dot gnu dot org
2004-02-27 18:45 ` dnovillo at gcc dot gnu dot org
2004-03-04  3:00 ` dnovillo at gcc dot gnu dot org
2004-03-07  2:03 ` pinskia at gcc dot gnu dot org
2004-03-09 15:05 ` dnovillo at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040227131638.15537.qmail@sources.redhat.com \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).