aboutsummaryrefslogtreecommitdiff
path: root/gcc/gcse.c
diff options
context:
space:
mode:
authorDaniel Berlin <dberlin@dberlin.org>2002-06-27 15:56:40 +0000
committerJeff Law <law@gcc.gnu.org>2002-06-27 09:56:40 -0600
commitc635a1ec844af64c920e115dde6901f37cbf00af (patch)
tree97296d105e28688bcbd1cdda2c2d61def5731c1c /gcc/gcse.c
parent86422829205fb7e87f25f37d226f4c3d4b81d784 (diff)
downloadgcc-c635a1ec844af64c920e115dde6901f37cbf00af.zip
gcc-c635a1ec844af64c920e115dde6901f37cbf00af.tar.gz
gcc-c635a1ec844af64c920e115dde6901f37cbf00af.tar.bz2
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
Diffstat (limited to 'gcc/gcse.c')
-rw-r--r--gcc/gcse.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/gcc/gcse.c b/gcc/gcse.c
index e732008..daeaa90 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);