From 8d77f669e4cf7644bbd8274acba5587a4dd79957 Mon Sep 17 00:00:00 2001 From: kazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Mon, 22 Nov 2004 15:18:50 +0000 Subject: PR rtl-optimization/18599 * regrename.c (copyprop_hardreg_forward): Speed up by putting BB_VISITED flags on basic blocks as we process them. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@91016 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/regrename.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'gcc/regrename.c') diff --git a/gcc/regrename.c b/gcc/regrename.c index 3153e5c353f..35f17a4d1d2 100644 --- a/gcc/regrename.c +++ b/gcc/regrename.c @@ -1745,24 +1745,31 @@ copyprop_hardreg_forward (void) { struct value_data *all_vd; bool need_refresh; - basic_block bb, bbp = 0; + basic_block bb; need_refresh = false; all_vd = xmalloc (sizeof (struct value_data) * last_basic_block); + /* Clear all BB_VISITED flags. We use BB_VISITED flags to indicate + whether we have processed a given basic block or not. Note that + we never put BB_VISITED flag on ENTRY_BLOCK_PTR throughout this + function because we want to call init_value_data for all + successors of ENTRY_BLOCK_PTR. */ + FOR_ALL_BB (bb) + bb->flags &= ~BB_VISITED; + FOR_EACH_BB (bb) { + bb->flags |= BB_VISITED; + /* If a block has a single predecessor, that we've already processed, begin with the value data that was live at the end of the predecessor block. */ /* ??? Ought to use more intelligent queuing of blocks. */ - if (EDGE_COUNT (bb->preds) == 1) - for (bbp = bb; bbp && bbp != EDGE_PRED (bb, 0)->src; bbp = bbp->prev_bb); if (EDGE_COUNT (bb->preds) == 1 - && ! (EDGE_PRED (bb, 0)->flags & (EDGE_ABNORMAL_CALL | EDGE_EH)) - && EDGE_PRED (bb, 0)->src != ENTRY_BLOCK_PTR - && bbp) + && ((EDGE_PRED (bb, 0)->src->flags & BB_VISITED) != 0) + && ! (EDGE_PRED (bb, 0)->flags & (EDGE_ABNORMAL_CALL | EDGE_EH))) all_vd[bb->index] = all_vd[EDGE_PRED (bb, 0)->src->index]; else init_value_data (all_vd + bb->index); @@ -1771,6 +1778,12 @@ copyprop_hardreg_forward (void) need_refresh = true; } + /* Clear BB_VISITED flag on each basic block. We do not need to + clear the one on ENTRY_BLOCK_PTR because it's already cleared + above. */ + FOR_EACH_BB (bb) + bb->flags &= ~BB_VISITED; + if (need_refresh) { if (dump_file) -- cgit v1.2.1