From c635a1ec844af64c920e115dde6901f37cbf00af Mon Sep 17 00:00:00 2001 From: Daniel Berlin Date: Thu, 27 Jun 2002 15:56:40 +0000 Subject: [PATCH] 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 --- gcc/ChangeLog | 6 ++++++ gcc/gcse.c | 26 ++++++++++++++++---------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8b4df3f1cc6..273924b1374 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2002-06-27 Daniel Berlin + + * 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 * cpphash.h (_cpp_set_trad_context): Remove. diff --git a/gcc/gcse.c b/gcc/gcse.c index e73200840a2..daeaa909144 100644 --- a/gcc/gcse.c +++ b/gcc/gcse.c @@ -5911,7 +5911,9 @@ static void hoist_code () { basic_block bb, dominated; - unsigned int i; + basic_block *domby; + unsigned int domby_len; + unsigned int i,j; struct expr **index_map; struct expr *expr; @@ -5932,24 +5934,25 @@ hoist_code () int found = 0; int insn_inserted_p; + domby_len = get_dominated_by (dominators, bb, &domby); /* Examine each expression that is very busy at the exit of this block. These are the potentially hoistable expressions. */ for (i = 0; i < hoist_vbeout[bb->index]->n_bits; i++) { 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 look at every block BB dominates to see if it computes the expression. */ - FOR_EACH_BB (dominated) + for (j = 0; j < domby_len; j++) { + dominated = domby[j]; /* Ignore self dominance. */ - if (bb == dominated - || dominated_by_p (dominators, dominated, bb)) + if (bb == dominated) continue; - /* We've found a dominated block, now see if it computes the busy expression and whether or not moving that expression to the "beginning" of that block is safe. */ @@ -5982,10 +5985,12 @@ hoist_code () } } } - /* If we found nothing to hoist, then quit now. */ if (! found) + { + free (domby); continue; + } /* Loop over all the hoistable expressions. */ for (i = 0; i < hoist_exprs[bb->index]->n_bits; i++) @@ -6000,11 +6005,11 @@ hoist_code () /* We've found a potentially hoistable expression, now we look at every block BB dominates to see if it computes the expression. */ - FOR_EACH_BB (dominated) + for (j = 0; j < domby_len; j++) { + dominated = domby[j]; /* Ignore self dominance. */ - if (bb == dominated - || ! dominated_by_p (dominators, dominated, bb)) + if (bb == dominated) continue; /* We've found a dominated block, now see if it computes @@ -6058,6 +6063,7 @@ hoist_code () } } } + free (domby); } free (index_map); -- 2.30.2