public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/60973] Invalid propagation of a tail call in devirt pass
Date: Mon, 28 Apr 2014 09:49:00 -0000	[thread overview]
Message-ID: <bug-60973-4-txU9lCtbIY@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-60973-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60973

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Target|                            |h8300-elf
                 CC|                            |hubicka at gcc dot gnu.org,
                   |                            |jamborm at gcc dot gnu.org
          Component|tree-optimization           |ipa
            Summary|Invalid propagation of a    |Invalid propagation of a
                   |tail call in copyrename2    |tail call in devirt pass
                   |pass                        |

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
It's not copyrename (that's just the first dump you see it) but inlining.
Inlining probably needs to clear [tailcall] from all inlined stmts unless
it wants to prove the tailcall is still possible.

Thus,

Index: gcc/tree-inline.c
===================================================================
--- gcc/tree-inline.c   (revision 209782)
+++ gcc/tree-inline.c   (working copy)
@@ -1485,6 +1489,11 @@ remap_gimple_stmt (gimple stmt, copy_bod
       /* Create a new deep copy of the statement.  */
       copy = gimple_copy (stmt);

+      /* Clear flags that need revisiting.  */
+      if (is_gimple_call (copy)
+         && gimple_call_tail_p (copy))
+       gimple_call_set_tail (copy, false);
+
       /* Remap the region numbers for __builtin_eh_{pointer,filter},
         RESX and EH_DISPATCH.  */
       if (id->eh_map)

not sure if GF_CALL_FROM_THUNK needs similar handling.

The bug is probably not h8300-elf specific (but usually tailcall expansion
fails as it re-checks the validity of the transform - and IIRC that is
required, so it may even be a h8300-elf backend bug).


  reply	other threads:[~2014-04-28  9:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-26  8:27 [Bug tree-optimization/60973] New: Invalid propagation of a tail call in copyrename2 pass ubizjak at gmail dot com
2014-04-28  9:49 ` rguenth at gcc dot gnu.org [this message]
2014-05-06 11:28 ` [Bug ipa/60973] Invalid propagation of a tail call in devirt pass hubicka at gcc dot gnu.org
2014-05-07 18:10 ` ubizjak at gmail dot com
2014-05-09 10:56 ` rguenth at gcc dot gnu.org
2014-05-09 14:27 ` hubicka at ucw dot cz
2014-05-13  7:57 ` rguenth at gcc dot gnu.org
2014-05-13 11:05 ` rguenth at gcc dot gnu.org
2014-05-13 11:06 ` rguenth at gcc dot gnu.org
2014-05-13 11:06 ` rguenth at gcc dot gnu.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=bug-60973-4-txU9lCtbIY@http.gcc.gnu.org/bugzilla/ \
    --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).