Commit 1a1804c2 by Diego Novillo Committed by Diego Novillo

tree-cfg.c (bsi_for_stmt): Rename from stmt_for_bsi.


	* tree-cfg.c (bsi_for_stmt): Rename from stmt_for_bsi.
	Update all callers.
	* tree-ssa.c (replace_immediate_uses): Call bsi_for_stmt.
	Don't call fold_stmt more than once, use bsi_replace.

From-SVN: r89234
parent bca9e17b
2004-10-18 Diego Novillo <dnovillo@redhat.com> 2004-10-18 Diego Novillo <dnovillo@redhat.com>
* tree-cfg.c (bsi_for_stmt): Rename from stmt_for_bsi.
Update all callers.
* tree-ssa.c (replace_immediate_uses): Call bsi_for_stmt.
Don't call fold_stmt more than once, use bsi_replace.
2004-10-18 Diego Novillo <dnovillo@redhat.com>
PR tree-optimization/17656 PR tree-optimization/17656
* tree-ssa.c (replace_immediate_uses): When replacing a * tree-ssa.c (replace_immediate_uses): When replacing a
constant, if the call to fold_stmt produced a different constant, if the call to fold_stmt produced a different
......
...@@ -1937,7 +1937,7 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest, ...@@ -1937,7 +1937,7 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest,
LBV_COEFFICIENTS (lbv)[i] = 1; LBV_COEFFICIENTS (lbv)[i] = 1;
lbv = lambda_body_vector_compute_new (transform, lbv); lbv = lambda_body_vector_compute_new (transform, lbv);
newiv = lbv_to_gcc_expression (lbv, new_ivs, &stmts); newiv = lbv_to_gcc_expression (lbv, new_ivs, &stmts);
bsi = stmt_for_bsi (stmt); bsi = bsi_for_stmt (stmt);
/* Insert the statements to build that /* Insert the statements to build that
expression. */ expression. */
bsi_insert_before (&bsi, stmts, BSI_SAME_STMT); bsi_insert_before (&bsi, stmts, BSI_SAME_STMT);
......
...@@ -2638,7 +2638,7 @@ set_bb_for_stmt (tree t, basic_block bb) ...@@ -2638,7 +2638,7 @@ set_bb_for_stmt (tree t, basic_block bb)
/* Finds iterator for STMT. */ /* Finds iterator for STMT. */
extern block_stmt_iterator extern block_stmt_iterator
stmt_for_bsi (tree stmt) bsi_for_stmt (tree stmt)
{ {
block_stmt_iterator bsi; block_stmt_iterator bsi;
......
...@@ -416,7 +416,7 @@ typedef struct { ...@@ -416,7 +416,7 @@ typedef struct {
static inline block_stmt_iterator bsi_start (basic_block); static inline block_stmt_iterator bsi_start (basic_block);
static inline block_stmt_iterator bsi_last (basic_block); static inline block_stmt_iterator bsi_last (basic_block);
static inline block_stmt_iterator bsi_after_labels (basic_block); static inline block_stmt_iterator bsi_after_labels (basic_block);
block_stmt_iterator stmt_for_bsi (tree); block_stmt_iterator bsi_for_stmt (tree);
static inline bool bsi_end_p (block_stmt_iterator); static inline bool bsi_end_p (block_stmt_iterator);
static inline void bsi_next (block_stmt_iterator *); static inline void bsi_next (block_stmt_iterator *);
static inline void bsi_prev (block_stmt_iterator *); static inline void bsi_prev (block_stmt_iterator *);
......
...@@ -3878,7 +3878,7 @@ remove_statement (tree stmt, bool including_defined_name) ...@@ -3878,7 +3878,7 @@ remove_statement (tree stmt, bool including_defined_name)
} }
else else
{ {
block_stmt_iterator bsi = stmt_for_bsi (stmt); block_stmt_iterator bsi = bsi_for_stmt (stmt);
bsi_remove (&bsi); bsi_remove (&bsi);
} }
...@@ -3916,7 +3916,7 @@ rewrite_use_nonlinear_expr (struct ivopts_data *data, ...@@ -3916,7 +3916,7 @@ rewrite_use_nonlinear_expr (struct ivopts_data *data,
case MODIFY_EXPR: case MODIFY_EXPR:
tgt = TREE_OPERAND (use->stmt, 0); tgt = TREE_OPERAND (use->stmt, 0);
bsi = stmt_for_bsi (use->stmt); bsi = bsi_for_stmt (use->stmt);
break; break;
default: default:
...@@ -4055,7 +4055,7 @@ rewrite_use_address (struct ivopts_data *data, ...@@ -4055,7 +4055,7 @@ rewrite_use_address (struct ivopts_data *data,
{ {
tree comp = unshare_expr (get_computation (data->current_loop, tree comp = unshare_expr (get_computation (data->current_loop,
use, cand)); use, cand));
block_stmt_iterator bsi = stmt_for_bsi (use->stmt); block_stmt_iterator bsi = bsi_for_stmt (use->stmt);
tree stmts; tree stmts;
tree op = force_gimple_operand (comp, &stmts, true, NULL_TREE); tree op = force_gimple_operand (comp, &stmts, true, NULL_TREE);
...@@ -4074,7 +4074,7 @@ rewrite_use_compare (struct ivopts_data *data, ...@@ -4074,7 +4074,7 @@ rewrite_use_compare (struct ivopts_data *data,
{ {
tree comp; tree comp;
tree *op_p, cond, op, stmts, bound; tree *op_p, cond, op, stmts, bound;
block_stmt_iterator bsi = stmt_for_bsi (use->stmt); block_stmt_iterator bsi = bsi_for_stmt (use->stmt);
enum tree_code compare; enum tree_code compare;
if (may_eliminate_iv (data->current_loop, if (may_eliminate_iv (data->current_loop,
......
...@@ -1105,20 +1105,9 @@ replace_immediate_uses (tree var, tree repl) ...@@ -1105,20 +1105,9 @@ replace_immediate_uses (tree var, tree repl)
fold_stmt (&tmp); fold_stmt (&tmp);
if (tmp != stmt) if (tmp != stmt)
{ {
basic_block bb = bb_for_stmt (stmt); block_stmt_iterator si = bsi_for_stmt (stmt);
block_stmt_iterator si; bsi_replace (&si, tmp, true);
stmt = bsi_stmt (si);
/* Start iterating at the start of the basic block
holding STMT until we reach it. This is slow, but
it's the only way to get a statement pointer
reliably. */
for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
if (bsi_stmt (si) == stmt)
{
fold_stmt (bsi_stmt_ptr (si));
stmt = bsi_stmt (si);
break;
}
} }
} }
......
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