Commit c635a1ec by Daniel Berlin Committed by Jeff Law

gcse.c (hoist_code): Rewrite to only get list of dominated blocks once per BB.

        * gcse.c (hoist_code): Rewrite to only get list of dominated
        blocks once per BB. Also fix reversed test (by removing need for
        the test at all).

From-SVN: r55031
parent 86422829
2002-06-27 Daniel Berlin <dberlin@dberlin.org>
* gcse.c (hoist_code): Rewrite to only get list of dominated
blocks once per BB. Also fix reversed test (by removing need for
the test at all).
2002-06-27 Neil Booth <neil@daikokuya.co.uk> 2002-06-27 Neil Booth <neil@daikokuya.co.uk>
* cpphash.h (_cpp_set_trad_context): Remove. * cpphash.h (_cpp_set_trad_context): Remove.
......
...@@ -5911,7 +5911,9 @@ static void ...@@ -5911,7 +5911,9 @@ static void
hoist_code () hoist_code ()
{ {
basic_block bb, dominated; basic_block bb, dominated;
unsigned int i; basic_block *domby;
unsigned int domby_len;
unsigned int i,j;
struct expr **index_map; struct expr **index_map;
struct expr *expr; struct expr *expr;
...@@ -5932,24 +5934,25 @@ hoist_code () ...@@ -5932,24 +5934,25 @@ hoist_code ()
int found = 0; int found = 0;
int insn_inserted_p; int insn_inserted_p;
domby_len = get_dominated_by (dominators, bb, &domby);
/* Examine each expression that is very busy at the exit of this /* Examine each expression that is very busy at the exit of this
block. These are the potentially hoistable expressions. */ block. These are the potentially hoistable expressions. */
for (i = 0; i < hoist_vbeout[bb->index]->n_bits; i++) for (i = 0; i < hoist_vbeout[bb->index]->n_bits; i++)
{ {
int hoistable = 0; int hoistable = 0;
if (TEST_BIT (hoist_vbeout[bb->index], i) && TEST_BIT (transpout[bb->index], i)) if (TEST_BIT (hoist_vbeout[bb->index], i)
&& TEST_BIT (transpout[bb->index], i))
{ {
/* We've found a potentially hoistable expression, now /* We've found a potentially hoistable expression, now
we look at every block BB dominates to see if it we look at every block BB dominates to see if it
computes the expression. */ computes the expression. */
FOR_EACH_BB (dominated) for (j = 0; j < domby_len; j++)
{ {
dominated = domby[j];
/* Ignore self dominance. */ /* Ignore self dominance. */
if (bb == dominated if (bb == dominated)
|| dominated_by_p (dominators, dominated, bb))
continue; continue;
/* We've found a dominated block, now see if it computes /* We've found a dominated block, now see if it computes
the busy expression and whether or not moving that the busy expression and whether or not moving that
expression to the "beginning" of that block is safe. */ expression to the "beginning" of that block is safe. */
...@@ -5982,10 +5985,12 @@ hoist_code () ...@@ -5982,10 +5985,12 @@ hoist_code ()
} }
} }
} }
/* If we found nothing to hoist, then quit now. */ /* If we found nothing to hoist, then quit now. */
if (! found) if (! found)
{
free (domby);
continue; continue;
}
/* Loop over all the hoistable expressions. */ /* Loop over all the hoistable expressions. */
for (i = 0; i < hoist_exprs[bb->index]->n_bits; i++) for (i = 0; i < hoist_exprs[bb->index]->n_bits; i++)
...@@ -6000,11 +6005,11 @@ hoist_code () ...@@ -6000,11 +6005,11 @@ hoist_code ()
/* We've found a potentially hoistable expression, now /* We've found a potentially hoistable expression, now
we look at every block BB dominates to see if it we look at every block BB dominates to see if it
computes the expression. */ computes the expression. */
FOR_EACH_BB (dominated) for (j = 0; j < domby_len; j++)
{ {
dominated = domby[j];
/* Ignore self dominance. */ /* Ignore self dominance. */
if (bb == dominated if (bb == dominated)
|| ! dominated_by_p (dominators, dominated, bb))
continue; continue;
/* We've found a dominated block, now see if it computes /* We've found a dominated block, now see if it computes
...@@ -6058,6 +6063,7 @@ hoist_code () ...@@ -6058,6 +6063,7 @@ hoist_code ()
} }
} }
} }
free (domby);
} }
free (index_map); free (index_map);
......
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