http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52139

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-02-07 
11:42:35 UTC ---
Created attachment 26602
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26602
gcc47-pr52139.patch

Ugh, this is ugly.  The main problem is that delete_insn/remove_insn refuse to
remove insns with NEXT_INSN (insn) == NULL_RTX (unless they are in the current
sequence or in the sequence stack).  Unfortunately in the cfglayout mode BB_END
or end of bb->il.rtl->{header,footer} often/always have it NULL.

In this testcase, we are merging two bbs where the first bb ends with an
unconditional jump to the second and second bb contains switch table followed
by barrier in its header, then deleted label, then NOTE_INSN_BASIC_BLOCK and
that is the last insn in that bb.  The first problem is that we
delete_insn_chain in the header just all but the last insn, so BB_END (a)
points to a BARRIER.  And the second problem is that when removing the
NOTE_INSN_BASIC_BLOCK note using delete_insn, NEXT_INSN (note) is NULL and thus
remove_insn ICEs.

The following ugly hacks fix it, but am not very happy about them.

Reply via email to