From 8f8dcce4abc08b582f0124d0b5a053bf36a34db0 Mon Sep 17 00:00:00 2001 From: rth Date: Wed, 10 Apr 2002 00:15:58 +0000 Subject: * basic-block.h (flow_delete_block_noexpunge): Declare. (expunge_block_nocompact): Declare. * cfg.c (expunge_block_nocompact): Split out from ... (expunge_block): ... here. * cfgrtl.c (can_delete_label_p): Don't use exception_handler_labels. (flow_delete_block_noexpunge): Split out from ... (flow_delete_block): ... here. * cfgcleanup.c (delete_unreachable_blocks): Compact while removing dead blocks. * except.c (exception_handler_labels): Remove. (exception_handler_label_map): New. (struct eh_region): Add aka member. (mark_ehl_map_entry, mark_ehl_map, free_region): New. (ehl_hash, ehl_eq, ehl_free, add_ehl_entry): New. (for_each_eh_label, for_each_eh_label_1): New. (init_eh): Register exception_handler_label_map. (free_eh_status): Use free_region. (find_exception_handler_labels): Use the map, not the list. (remove_exception_handler_label): Likewise. (maybe_remove_eh_handler): Likewise. (remove_eh_handler): Use the region aka bitmap. * except.h (exception_handler_labels): Remove. (for_each_eh_label): Declare. * jump.c (rebuild_jump_labels): Don't check exception_handler_labels. * loop.c (invalidate_loops_containing_label): New. (find_and_verify_loops): Use it. Use for_each_eh_label. * sched-rgn.c (is_cfg_nonregular): Use current_function_has_exception_handlers. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@52100 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cfgcleanup.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'gcc/cfgcleanup.c') diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index b6a7f0cc4ea..74a2256b5e2 100644 --- a/gcc/cfgcleanup.c +++ b/gcc/cfgcleanup.c @@ -1,6 +1,6 @@ /* Control flow optimization code for GNU compiler. Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001 Free Software Foundation, Inc. + 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GCC. @@ -1751,22 +1751,33 @@ try_optimize_cfg (mode) static bool delete_unreachable_blocks () { - int i; + int i, j; bool changed = false; find_unreachable_blocks (); - /* Delete all unreachable basic blocks. Count down so that we - don't interfere with the block renumbering that happens in - flow_delete_block. */ + /* Delete all unreachable basic blocks. Do compaction concurrently, + as otherwise we can wind up with O(N^2) behaviour here when we + have oodles of dead code. */ - for (i = n_basic_blocks - 1; i >= 0; --i) + for (i = j = 0; i < n_basic_blocks; ++i) { basic_block b = BASIC_BLOCK (i); if (!(b->flags & BB_REACHABLE)) - flow_delete_block (b), changed = true; + { + flow_delete_block_noexpunge (b); + expunge_block_nocompact (b); + changed = true; + } + else + { + BASIC_BLOCK (j) = b; + b->index = j++; + } } + n_basic_blocks = j; + basic_block_info->num_elements = j; if (changed) tidy_fallthru_edges (); -- cgit v1.2.1