From 91f0f975e684fb47640ab65596170f549103ce69 Mon Sep 17 00:00:00 2001 From: Bernd Schmidt Date: Mon, 6 Jul 2015 12:49:26 +0000 Subject: [PATCH] Fix assert caused by bad cfg manipulation in bfin. 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 | 6 ++++++ gcc/config/bfin/bfin.c | 13 ++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2319b0dca4c..e2b9974a9c8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-07-06 Bernd Schmidt + + 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 PR target/53383 diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c index 8c1e18a2731..2c6f1958f52 100644 --- a/gcc/config/bfin/bfin.c +++ b/gcc/config/bfin/bfin.c @@ -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 { -- 2.30.2