------- Comment #9 from hjl dot tools at gmail dot com 2009-05-05 16:28 ------- (In reply to comment #8) > Created an attachment (id=17803) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17803&action=view) [edit] > fix for the problem > > I'm regstrapping this patch, it fixes the problem in the testcase. >
Shouldn't + { + rtx insn; + remove_edge (false_edge); + /* Now, we have a single successor block, if we have insns to + insert on the remaining edge we potentially will insert + it at the end of this block (if the dest block isn't feasible) + in order to avoid splitting the edge. This insertion will take + place in front of the last jump. But we might have emitted + multiple jumps (conditional and one unconditional) to the + same destination. Inserting in front of the last one then + is a problem. See PR 40021. We fix this by deleting all + jumps except the last unconditional one. */ + insn = PREV_INSN (get_last_insn ()); + /* Make sure we have an unconditional jump. Otherwise we're + confused. */ + gcc_assert (JUMP_P (insn) && !any_condjump_p (insn)); + for (insn = PREV_INSN (insn); insn != BB_HEAD (bb);) + { + insn = PREV_INSN (insn); + if (JUMP_P (NEXT_INSN (insn))) + delete_insn (NEXT_INSN (insn)); + } + } in a standalone function since it is used twice? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40021