diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0d6d39918d5..86ea00b29ce 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2004-11-22 Kazu Hirata + + PR rtl-optimization/18599 + * regrename.c (copyprop_hardreg_forward): Speed up by putting + BB_VISITED flags on basic blocks as we process them. + 2004-11-22 Nathan Sidwell * config/rs6000/altivec.md (VI_char): New mode attribute. 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)