aboutsummaryrefslogtreecommitdiff
path: root/gcc/cse.c
diff options
context:
space:
mode:
authorSteven Bosscher <steven@gcc.gnu.org>2006-12-17 13:12:37 +0000
committerSteven Bosscher <steven@gcc.gnu.org>2006-12-17 13:12:37 +0000
commit27511c652d48c3cd9d49aabb9da35c58b5813b02 (patch)
treecc9c266ef1bc257bbe93f684bd3bb24144d88eaf /gcc/cse.c
parent96fb470d746061e78c452e35533d534e44b269bb (diff)
downloadgcc-27511c652d48c3cd9d49aabb9da35c58b5813b02.zip
gcc-27511c652d48c3cd9d49aabb9da35c58b5813b02.tar.gz
gcc-27511c652d48c3cd9d49aabb9da35c58b5813b02.tar.bz2
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
Diffstat (limited to 'gcc/cse.c')
-rw-r--r--gcc/cse.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/gcc/cse.c b/gcc/cse.c
index fc6ffff..bd33190 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -5905,11 +5905,10 @@ cse_find_path (basic_block first_bb, struct cse_basic_block_data *data,
{
basic_block bb2 = e->dest;
-#if ENABLE_CHECKING
/* We should only see blocks here that we have not
visited yet. */
gcc_assert (!TEST_BIT (cse_visited_basic_blocks, bb2->index));
-#endif
+
SET_BIT (cse_visited_basic_blocks, bb2->index);
data->path[path_size++].bb = bb2;
bb = bb2;
@@ -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;
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
@@ -6159,7 +6172,7 @@ cse_main (rtx f ATTRIBUTE_UNUSED, int nregs)
{
struct cse_basic_block_data ebb_data;
basic_block bb;
- int *dfs_order = XNEWVEC (int, last_basic_block);
+ int *rc_order = XNEWVEC (int, last_basic_block);
int i, n_blocks;
init_cse_reg_info (nregs);
@@ -6199,7 +6212,7 @@ cse_main (rtx f ATTRIBUTE_UNUSED, int nregs)
/* Loop over basic blocks in DFS order,
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;
while (i < n_blocks)
{
@@ -6207,7 +6220,7 @@ cse_main (rtx f ATTRIBUTE_UNUSED, int nregs)
processed before. */
do
{
- bb = BASIC_BLOCK (dfs_order[i++]);
+ bb = BASIC_BLOCK (rc_order[i++]);
}
while (TEST_BIT (cse_visited_basic_blocks, bb->index)
&& i < n_blocks);
@@ -6243,7 +6256,7 @@ cse_main (rtx f ATTRIBUTE_UNUSED, int nregs)
free (reg_eqv_table);
free (ebb_data.path);
sbitmap_free (cse_visited_basic_blocks);
- free (dfs_order);
+ free (rc_order);
rtl_hooks = general_rtl_hooks;
return cse_jumps_altered || recorded_label_ref;
@@ -6963,9 +6976,7 @@ gate_handle_cse (void)
static unsigned int
rest_of_handle_cse (void)
{
-static int counter = 0;
int tem;
-counter++;
if (dump_file)
dump_flow_info (dump_file, dump_flags);