Commit 27511c65 by Steven Bosscher

cse.c (cse_find_path): Don't wrap a gcc_assert in ENABLE_CHECKING.

	* cse.c (cse_find_path): Don't wrap a gcc_assert in ENABLE_CHECKING.
	(cse_extended_basic_block): When truncating a path while processing
	it, make sure to clear the visited bit on the basic blocks in the
	truncated part of the path.
	(cse_main): Use reverse completion order, not DFS order, to walk
	the CFG.
	(gate_handle_cse): Revert erroneous commit of a counter.

From-SVN: r119985
parent 96fb470d
2006-12-17 Steven Bosscher <steven@gcc.gnu.org> 2006-12-17 Steven Bosscher <steven@gcc.gnu.org>
* cse.c (cse_find_path): Don't wrap a gcc_assert in ENABLE_CHECKING.
(cse_extended_basic_block): When truncating a path while processing
it, make sure to clear the visited bit on the basic blocks in the
truncated part of the path.
(cse_main): Use reverse completion order, not DFS order, to walk
the CFG.
(gate_handle_cse): Revert erroneous commit of a counter.
2006-12-17 Steven Bosscher <steven@gcc.gnu.org>
* cse.c (this_insn_cc0, this_insn_cc0_mode): New global * cse.c (this_insn_cc0, this_insn_cc0_mode): New global
variables, moved out from cse_insn. variables, moved out from cse_insn.
(prev_insn): Remove this global variable). (prev_insn): Remove this global variable).
......
...@@ -5905,11 +5905,10 @@ cse_find_path (basic_block first_bb, struct cse_basic_block_data *data, ...@@ -5905,11 +5905,10 @@ cse_find_path (basic_block first_bb, struct cse_basic_block_data *data,
{ {
basic_block bb2 = e->dest; basic_block bb2 = e->dest;
#if ENABLE_CHECKING
/* We should only see blocks here that we have not /* We should only see blocks here that we have not
visited yet. */ visited yet. */
gcc_assert (!TEST_BIT (cse_visited_basic_blocks, bb2->index)); gcc_assert (!TEST_BIT (cse_visited_basic_blocks, bb2->index));
#endif
SET_BIT (cse_visited_basic_blocks, bb2->index); SET_BIT (cse_visited_basic_blocks, bb2->index);
data->path[path_size++].bb = bb2; data->path[path_size++].bb = bb2;
bb = bb2; bb = bb2;
...@@ -6119,7 +6118,21 @@ cse_extended_basic_block (struct cse_basic_block_data *ebb_data) ...@@ -6119,7 +6118,21 @@ cse_extended_basic_block (struct cse_basic_block_data *ebb_data)
{ {
basic_block next_bb = ebb_data->path[path_entry + 1].bb; basic_block next_bb = ebb_data->path[path_entry + 1].bb;
if (!find_edge (bb, next_bb)) if (!find_edge (bb, next_bb))
ebb_data->path_size = path_entry + 1; {
do
{
path_size--;
/* If we truncate the path, we must also reset the
visited bit on the remaining blocks in the path,
or we will never visit them at all. */
RESET_BIT (cse_visited_basic_blocks,
ebb_data->path[path_size].bb->index);
ebb_data->path[path_size].bb = NULL;
}
while (path_size - 1 != path_entry);
ebb_data->path_size = path_size;
}
} }
/* If this is a conditional jump insn, record any known /* If this is a conditional jump insn, record any known
...@@ -6159,7 +6172,7 @@ cse_main (rtx f ATTRIBUTE_UNUSED, int nregs) ...@@ -6159,7 +6172,7 @@ cse_main (rtx f ATTRIBUTE_UNUSED, int nregs)
{ {
struct cse_basic_block_data ebb_data; struct cse_basic_block_data ebb_data;
basic_block bb; basic_block bb;
int *dfs_order = XNEWVEC (int, last_basic_block); int *rc_order = XNEWVEC (int, last_basic_block);
int i, n_blocks; int i, n_blocks;
init_cse_reg_info (nregs); init_cse_reg_info (nregs);
...@@ -6199,7 +6212,7 @@ cse_main (rtx f ATTRIBUTE_UNUSED, int nregs) ...@@ -6199,7 +6212,7 @@ cse_main (rtx f ATTRIBUTE_UNUSED, int nregs)
/* Loop over basic blocks in DFS order, /* Loop over basic blocks in DFS order,
excluding the ENTRY and EXIT blocks. */ excluding the ENTRY and EXIT blocks. */
n_blocks = pre_and_rev_post_order_compute (dfs_order, NULL, false); n_blocks = pre_and_rev_post_order_compute (NULL, rc_order, false);
i = 0; i = 0;
while (i < n_blocks) while (i < n_blocks)
{ {
...@@ -6207,7 +6220,7 @@ cse_main (rtx f ATTRIBUTE_UNUSED, int nregs) ...@@ -6207,7 +6220,7 @@ cse_main (rtx f ATTRIBUTE_UNUSED, int nregs)
processed before. */ processed before. */
do do
{ {
bb = BASIC_BLOCK (dfs_order[i++]); bb = BASIC_BLOCK (rc_order[i++]);
} }
while (TEST_BIT (cse_visited_basic_blocks, bb->index) while (TEST_BIT (cse_visited_basic_blocks, bb->index)
&& i < n_blocks); && i < n_blocks);
...@@ -6243,7 +6256,7 @@ cse_main (rtx f ATTRIBUTE_UNUSED, int nregs) ...@@ -6243,7 +6256,7 @@ cse_main (rtx f ATTRIBUTE_UNUSED, int nregs)
free (reg_eqv_table); free (reg_eqv_table);
free (ebb_data.path); free (ebb_data.path);
sbitmap_free (cse_visited_basic_blocks); sbitmap_free (cse_visited_basic_blocks);
free (dfs_order); free (rc_order);
rtl_hooks = general_rtl_hooks; rtl_hooks = general_rtl_hooks;
return cse_jumps_altered || recorded_label_ref; return cse_jumps_altered || recorded_label_ref;
...@@ -6963,9 +6976,7 @@ gate_handle_cse (void) ...@@ -6963,9 +6976,7 @@ gate_handle_cse (void)
static unsigned int static unsigned int
rest_of_handle_cse (void) rest_of_handle_cse (void)
{ {
static int counter = 0;
int tem; int tem;
counter++;
if (dump_file) if (dump_file)
dump_flow_info (dump_file, dump_flags); dump_flow_info (dump_file, dump_flags);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment