bool changed_here = false;
/* Delete trivially dead basic blocks. */
- while (EDGE_COUNT (b->preds) == 0)
+ if (EDGE_COUNT (b->preds) == 0)
{
c = b->prev_bb;
if (dump_file)
delete_basic_block (b);
if (!(mode & CLEANUP_CFGLAYOUT))
changed = true;
- b = c;
+ /* Avoid trying to remove ENTRY_BLOCK_PTR. */
+ b = (c == ENTRY_BLOCK_PTR ? c->next_bb : c);
+ continue;
}
/* Remove code labels no longer used. */
reorder_insns_nobb (label, label, bb_note);
BB_HEAD (b) = bb_note;
+ if (BB_END (b) == bb_note)
+ BB_END (b) = label;
}
if (dump_file)
fprintf (dump_file, "Deleted label in block %i.\n",