]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-ssa-threadupdate.c (thread_through_loop_header): Do not thread through a joiner...
authorJeff Law <law@redhat.com>
Tue, 19 Nov 2013 03:30:08 +0000 (20:30 -0700)
committerJeff Law <law@gcc.gnu.org>
Tue, 19 Nov 2013 03:30:08 +0000 (20:30 -0700)
* tree-ssa-threadupdate.c (thread_through_loop_header):  Do not
thread through a joiner which has the latch edge.

From-SVN: r205003

gcc/ChangeLog
gcc/tree-ssa-threadupdate.c

index 14ed90f9a5375aff841e57a0e8164b1b232daade..841fd6c19b553a0fd1943f721cf8ba8d0bb50bd9 100644 (file)
@@ -1,3 +1,8 @@
+2013-11-19  Jeff Law  <law@redhat.com>
+
+       * tree-ssa-threadupdate.c (thread_through_loop_header):  Do not
+       thread through a joiner which has the latch edge.
+
 2013-11-19  Jan Hubicka  <jh@suse.cz>
 
        * md.texi (setmem): Document new parameter.
index 97dc6cbce34a6584e9ba6651f84014f522504fde..bc23f4c1fea581f6038568286586d5a62fbc4381 100644 (file)
@@ -1060,11 +1060,22 @@ thread_through_loop_header (struct loop *loop, bool may_peel_loop_headers)
   if (single_succ_p (header))
     goto fail;
 
+  /* If we threaded the latch using a joiner block, we cancel the
+     threading opportunity out of an abundance of caution.  However,
+     still allow threading from outside to inside the loop.  */
   if (latch->aux)
     {
       vec<jump_thread_edge *> *path = THREAD_PATH (latch);
       if ((*path)[1]->type == EDGE_COPY_SRC_JOINER_BLOCK)
-       goto fail;
+       {
+         delete_jump_thread_path (path);
+         latch->aux = NULL;
+       }
+    }
+
+  if (latch->aux)
+    {
+      vec<jump_thread_edge *> *path = THREAD_PATH (latch);
       tgt_edge = (*path)[1]->e;
       tgt_bb = tgt_edge->dest;
     }