Comments

On 27/11/11 23:59, Eric Botcazou wrote:
>> No, DELETED_LABEL notes still work just fine. It depends on how you>> remove the label and replace it with a note, and Tom isn't showing>> what he did, so...> > I agree that there is no obvious reason why just calling delete_insn would not > work, so this should be investigated first.>
The reason it didn't work, is because after turning a label into a
NOTE_INSN_DELETED_LABEL, one needs to move it to after the NOTE_INSN_BASIC_BLOCK
as in cfgcleanup.c:try_optimize_cfg():
...
delete_insn_chain (label, label, false);
/* If the case label is undeletable, move it after the
BASIC_BLOCK note. */
if (NOTE_KIND (BB_HEAD (b)) == NOTE_INSN_DELETED_LABEL)
{
rtx bb_note = NEXT_INSN (BB_HEAD (b));
reorder_insns_nobb (label, label, bb_note);
BB_HEAD (b) = bb_note;
if (BB_END (b) == bb_note)
BB_END (b) = label;
}
...
Attached patch factors out this piece of code and reuses it in fixup_reorder_chain.
Bootstrapped and reg-tested on x86_64.
OK for next stage1?
Thanks,
- Tom
2011-12-01 Tom de Vries <tom@codesourcery.com>
* cfgcleanup.c (fixup_deleted_label): New function, factored out of ...
(try_optimize_cfg): Use fixup_deleted_label.
* cfglayout.c (fixup_reorder_chain): Delete unused label, and fixup
using fixup_deleted_label.
* gcc.dg/superblock.c: New test.