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 tree-optimization/61607] DOM missed jump threading and destroyed loops
Date: Wed, 25 Jun 2014 12:43:00 -0000	[thread overview]
Message-ID: <bug-61607-4-ScW4q2Vf1b@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-61607-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61607

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Like with

Index: gcc/tree-ssa-threadupdate.c
===================================================================
--- gcc/tree-ssa-threadupdate.c (revision 211969)
+++ gcc/tree-ssa-threadupdate.c (working copy)
@@ -764,6 +764,14 @@ ssa_redirect_edges (struct redirection_d
          if ((*path)[1]->type != EDGE_COPY_SRC_JOINER_BLOCK)
            EDGE_SUCC (rd->dup_blocks[0], 0)->count += e->count;

+         /* If we redirect a loop latch edge cancel its loop.  */
+         if (e->src == e->src->loop_father->latch)
+           {
+             e->src->loop_father->header = NULL;
+             e->src->loop_father->latch = NULL;
+             loops_state_set (LOOPS_NEED_FIXUP);
+           }
+
          /* Redirect the incoming edge (possibly to the joiner block) to the
             appropriate duplicate block.  */
          e2 = redirect_edge_and_branch (e, rd->dup_blocks[0]);
@@ -853,32 +861,6 @@ thread_block_1 (basic_block bb, bool nol
   redirection_data
     = new hash_table<struct redirection_data> (EDGE_COUNT (bb->succs));

-  /* If we thread the latch of the loop to its exit, the loop ceases to
-     exist.  Make sure we do not restrict ourselves in order to preserve
-     this loop.  */
-  if (loop->header == bb)
-    {
-      e = loop_latch_edge (loop);
-      vec<jump_thread_edge *> *path = THREAD_PATH (e);
-
-      if (path
-         && (((*path)[1]->type == EDGE_COPY_SRC_JOINER_BLOCK && joiners)
-             || ((*path)[1]->type == EDGE_COPY_SRC_BLOCK && !joiners)))
-       {
-         for (unsigned int i = 1; i < path->length (); i++)
-           {
-             edge e2 = (*path)[i]->e;
-
-             if (loop_exit_edge_p (loop, e2))
-               {
-                 loop->header = NULL;
-                 loop->latch = NULL;
-                 loops_state_set (LOOPS_NEED_FIXUP);
-               }
-           }
-       }
-    }
-
   /* Record each unique threaded destination into a hash table for
      efficient lookups.  */
   FOR_EACH_EDGE (e, ei, bb->preds)


  parent reply	other threads:[~2014-06-25 12:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-61607-4@http.gcc.gnu.org/bugzilla/>
2014-06-25 11:59 ` rguenth at gcc dot gnu.org
2014-06-25 12:10 ` rguenth at gcc dot gnu.org
2014-06-25 12:43 ` rguenth at gcc dot gnu.org [this message]
2014-06-26  7:44 ` rguenth at gcc dot gnu.org
2014-06-26 11:30 ` rguenth at gcc dot gnu.org
2014-06-26 11:55 ` rguenth at gcc dot gnu.org
2014-06-27  6:21 ` law at redhat dot com
2014-06-27 18:56 ` law at redhat dot com
2014-06-30  6:57 ` law at redhat dot com
2015-03-05 14:28 ` yroux 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-61607-4-ScW4q2Vf1b@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).