Commit 89e606c9 by Jeffrey A Law Committed by Jeff Law

gcse.c (pre_expr_reaches_here_p): Kill CHECK_PRE_COM argument.

        * gcse.c (pre_expr_reaches_here_p): Kill CHECK_PRE_COM argument.
        All callers changed.
        (pre_expr_reaches_here_p_work): Likewise.
        (pre_edge_insert): No longer call pre_expr_reaches_here_p.
        * lcm.c (compute_laterin): Fix initialization of LATER.
        (compute_nearerout): Similarly for NEARER.

From-SVN: r30528
parent cd9f6678
Sun Nov 14 23:11:05 1999 Jeffrey A Law (law@cygnus.com)
* gcse.c (pre_expr_reaches_here_p): Kill CHECK_PRE_COM argument.
All callers changed.
(pre_expr_reaches_here_p_work): Likewise.
(pre_edge_insert): No longer call pre_expr_reaches_here_p.
* lcm.c (compute_laterin): Fix initialization of LATER.
(compute_nearerout): Similarly for NEARER.
Sun Nov 14 12:41:57 1999 Bernd Schmidt <bernds@cygnus.co.uk> Sun Nov 14 12:41:57 1999 Bernd Schmidt <bernds@cygnus.co.uk>
* cse.c (set_nonvarying_address_components): Delete unused function. * cse.c (set_nonvarying_address_components): Delete unused function.
......
...@@ -596,8 +596,7 @@ static int one_cprop_pass PROTO ((int, int)); ...@@ -596,8 +596,7 @@ static int one_cprop_pass PROTO ((int, int));
static void alloc_pre_mem PROTO ((int, int)); static void alloc_pre_mem PROTO ((int, int));
static void free_pre_mem PROTO ((void)); static void free_pre_mem PROTO ((void));
static void compute_pre_data PROTO ((void)); static void compute_pre_data PROTO ((void));
static int pre_expr_reaches_here_p PROTO ((int, struct expr *, static int pre_expr_reaches_here_p PROTO ((int, struct expr *, int));
int, int));
static void insert_insn_end_bb PROTO ((struct expr *, int, int)); static void insert_insn_end_bb PROTO ((struct expr *, int, int));
static void pre_insert_copy_insn PROTO ((struct expr *, rtx)); static void pre_insert_copy_insn PROTO ((struct expr *, rtx));
static void pre_insert_copies PROTO ((void)); static void pre_insert_copies PROTO ((void));
...@@ -640,7 +639,8 @@ static void delete_null_pointer_checks_1 PROTO ((int_list_ptr *, int *, ...@@ -640,7 +639,8 @@ static void delete_null_pointer_checks_1 PROTO ((int_list_ptr *, int *,
static rtx process_insert_insn PROTO ((struct expr *)); static rtx process_insert_insn PROTO ((struct expr *));
static int pre_edge_insert PROTO ((struct edge_list *, struct expr **)); static int pre_edge_insert PROTO ((struct edge_list *, struct expr **));
static int expr_reaches_here_p_work PROTO ((struct occr *, struct expr *, int, int, char *)); static int expr_reaches_here_p_work PROTO ((struct occr *, struct expr *, int, int, char *));
static int pre_expr_reaches_here_p_work PROTO ((int, struct expr *, int, int, char *)); static int pre_expr_reaches_here_p_work PROTO ((int, struct expr *,
int, char *));
/* Entry point for global common subexpression elimination. /* Entry point for global common subexpression elimination.
F is the first instruction in the function. */ F is the first instruction in the function. */
...@@ -4213,9 +4213,6 @@ compute_pre_data () ...@@ -4213,9 +4213,6 @@ compute_pre_data ()
VISITED is a pointer to a working buffer for tracking which BB's have VISITED is a pointer to a working buffer for tracking which BB's have
been visited. It is NULL for the top-level call. been visited. It is NULL for the top-level call.
CHECK_PRE_COMP controls whether or not we check for a computation of
EXPR in OCCR_BB.
We treat reaching expressions that go through blocks containing the same We treat reaching expressions that go through blocks containing the same
reaching expression as "not reaching". E.g. if EXPR is generated in blocks reaching expression as "not reaching". E.g. if EXPR is generated in blocks
2 and 3, INSN is in block 4, and 2->3->4, we treat the expression in block 2 and 3, INSN is in block 4, and 2->3->4, we treat the expression in block
...@@ -4224,11 +4221,10 @@ compute_pre_data () ...@@ -4224,11 +4221,10 @@ compute_pre_data ()
the closest such expression. */ the closest such expression. */
static int static int
pre_expr_reaches_here_p_work (occr_bb, expr, bb, check_pre_comp, visited) pre_expr_reaches_here_p_work (occr_bb, expr, bb, visited)
int occr_bb; int occr_bb;
struct expr *expr; struct expr *expr;
int bb; int bb;
int check_pre_comp;
char *visited; char *visited;
{ {
edge pred; edge pred;
...@@ -4244,8 +4240,7 @@ pre_expr_reaches_here_p_work (occr_bb, expr, bb, check_pre_comp, visited) ...@@ -4244,8 +4240,7 @@ pre_expr_reaches_here_p_work (occr_bb, expr, bb, check_pre_comp, visited)
/* Nothing to do. */ /* Nothing to do. */
} }
/* Does this predecessor generate this expression? */ /* Does this predecessor generate this expression? */
else if ((!check_pre_comp && occr_bb == pred_bb) else if (TEST_BIT (comp[pred_bb], expr->bitmap_index))
|| TEST_BIT (comp[pred_bb], expr->bitmap_index))
{ {
/* Is this the occurrence we're looking for? /* Is this the occurrence we're looking for?
Note that there's only one generating occurrence per block Note that there's only one generating occurrence per block
...@@ -4261,8 +4256,7 @@ pre_expr_reaches_here_p_work (occr_bb, expr, bb, check_pre_comp, visited) ...@@ -4261,8 +4256,7 @@ pre_expr_reaches_here_p_work (occr_bb, expr, bb, check_pre_comp, visited)
else else
{ {
visited[pred_bb] = 1; visited[pred_bb] = 1;
if (pre_expr_reaches_here_p_work (occr_bb, expr, pred_bb, if (pre_expr_reaches_here_p_work (occr_bb, expr, pred_bb, visited))
check_pre_comp, visited))
return 1; return 1;
} }
} }
...@@ -4275,17 +4269,15 @@ pre_expr_reaches_here_p_work (occr_bb, expr, bb, check_pre_comp, visited) ...@@ -4275,17 +4269,15 @@ pre_expr_reaches_here_p_work (occr_bb, expr, bb, check_pre_comp, visited)
memory allocated for that function is returned. */ memory allocated for that function is returned. */
static int static int
pre_expr_reaches_here_p (occr_bb, expr, bb, check_pre_comp) pre_expr_reaches_here_p (occr_bb, expr, bb)
int occr_bb; int occr_bb;
struct expr *expr; struct expr *expr;
int bb; int bb;
int check_pre_comp;
{ {
int rval; int rval;
char * visited = (char *) xcalloc (n_basic_blocks, 1); char * visited = (char *) xcalloc (n_basic_blocks, 1);
rval = pre_expr_reaches_here_p_work(occr_bb, expr, bb, check_pre_comp, rval = pre_expr_reaches_here_p_work(occr_bb, expr, bb, visited);
visited);
free (visited); free (visited);
...@@ -4529,10 +4521,7 @@ pre_edge_insert (edge_list, index_map) ...@@ -4529,10 +4521,7 @@ pre_edge_insert (edge_list, index_map)
/* Insert this expression on this edge if if it would /* Insert this expression on this edge if if it would
reach the deleted occurence in BB. */ reach the deleted occurence in BB. */
if (!TEST_BIT (inserted[e], j) if (!TEST_BIT (inserted[e], j))
&& (bb == ENTRY_BLOCK
|| pre_expr_reaches_here_p (bb, expr,
BLOCK_NUM (occr->insn), 0)))
{ {
rtx insn; rtx insn;
edge eg = INDEX_EDGE (edge_list, e); edge eg = INDEX_EDGE (edge_list, e);
...@@ -4660,7 +4649,7 @@ pre_insert_copies () ...@@ -4660,7 +4649,7 @@ pre_insert_copies ()
continue; continue;
/* Or if the expression doesn't reach the deleted one. */ /* Or if the expression doesn't reach the deleted one. */
if (! pre_expr_reaches_here_p (BLOCK_NUM (avail->insn), expr, if (! pre_expr_reaches_here_p (BLOCK_NUM (avail->insn), expr,
BLOCK_NUM (occr->insn),1)) BLOCK_NUM (occr->insn)))
continue; continue;
/* Copy the result of avail to reaching_reg. */ /* Copy the result of avail to reaching_reg. */
......
...@@ -269,6 +269,13 @@ compute_laterin (edge_list, earliest, antloc, later, laterin) ...@@ -269,6 +269,13 @@ compute_laterin (edge_list, earliest, antloc, later, laterin)
of the optimistic edge. That will requeue the affected blocks. */ of the optimistic edge. That will requeue the affected blocks. */
sbitmap_vector_ones (later, num_edges); sbitmap_vector_ones (later, num_edges);
/* Note that even though we want an optimistic setting of LATER, we
do not want to be overly optimistic. Consider an outgoing edge from
the entry block. That edge should always have a LATER value the
same as EARLIEST for that edge. */
for (e = ENTRY_BLOCK_PTR->succ; e; e = e->succ_next)
sbitmap_copy (later[(int)e->aux], earliest[(int)e->aux]);
/* Add all the blocks to the worklist. This prevents an early exit from /* Add all the blocks to the worklist. This prevents an early exit from
the loop given our optimistic initialization of LATER above. */ the loop given our optimistic initialization of LATER above. */
for (bb = n_basic_blocks - 1; bb >= 0; bb--) for (bb = n_basic_blocks - 1; bb >= 0; bb--)
...@@ -598,6 +605,13 @@ compute_nearerout (edge_list, farthest, st_avloc, nearer, nearerout) ...@@ -598,6 +605,13 @@ compute_nearerout (edge_list, farthest, st_avloc, nearer, nearerout)
/* We want a maximal solution. */ /* We want a maximal solution. */
sbitmap_vector_ones (nearer, num_edges); sbitmap_vector_ones (nearer, num_edges);
/* Note that even though we want an optimistic setting of NEARER, we
do not want to be overly optimistic. Consider an incoming edge to
the exit block. That edge should always have a NEARER value the
same as FARTHEST for that edge. */
for (e = EXIT_BLOCK_PTR->pred; e; e = e->pred_next)
sbitmap_copy (nearer[(int)e->aux], farthest[(int)e->aux]);
/* Add all the blocks to the worklist. This prevents an early exit /* Add all the blocks to the worklist. This prevents an early exit
from the loop given our optimistic initialization of NEARER. */ from the loop given our optimistic initialization of NEARER. */
for (bb = 0; bb < n_basic_blocks; bb++) for (bb = 0; bb < n_basic_blocks; bb++)
......
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