]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix assert caused by bad cfg manipulation in bfin.
authorBernd Schmidt <bernds@codesourcery.com>
Mon, 6 Jul 2015 12:49:26 +0000 (12:49 +0000)
committerBernd Schmidt <bernds@gcc.gnu.org>
Mon, 6 Jul 2015 12:49:26 +0000 (12:49 +0000)
PR target/66620
* config/bfin/bfin.c (hwloop_optimize): Create new bb between jump and
loop start when inserting LSETUP.

From-SVN: r225453

gcc/ChangeLog
gcc/config/bfin/bfin.c

index 2319b0dca4cca8652ec23775f07c349f104f7f2f..e2b9974a9c8db03bd2f2146824e149d55fb5c310 100644 (file)
@@ -1,3 +1,9 @@
+2015-07-06  Bernd Schmidt  <bernds@codesourcery.com>
+
+       PR target/66620
+       * config/bfin/bfin.c (hwloop_optimize): Create new bb between jump and
+       loop start when inserting LSETUP.
+
 2015-07-06  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR target/53383
index 8c1e18a27312314d58454ac35246257039cf0039..2c6f1958f5227d7d4fc786dd21a10acde8c867f1 100644 (file)
@@ -3796,8 +3796,19 @@ hwloop_optimize (hwloop_info loop)
        {
          gcc_assert (JUMP_P (prev));
          prev = PREV_INSN (prev);
+         emit_insn_after (seq, prev);
+       }
+      else
+       {
+         emit_insn_after (seq, prev);
+         BB_END (loop->incoming_src) = prev;
+         basic_block new_bb = create_basic_block (seq, seq_end,
+                                                  loop->head->prev_bb);
+         edge e = loop->incoming->last ();
+         gcc_assert (e->flags & EDGE_FALLTHRU);
+         redirect_edge_succ (e, new_bb);
+         make_edge (new_bb, loop->head, 0);
        }
-      emit_insn_after (seq, prev);
     }
   else
     {