+2004-08-10 Andrew MacLeod <amacleod@redhat.com>
+
+ * tree-cfg.c (bsi_insert_before, bsi_insert_after): Call modify_stmt
+ after linking stmt into the program.
+ (bsi_remove): Don't call modify_stmt.
+ * tree-complex.c (update_complex_assignment,
+ expand_complex_comparison): Call modify_stmt after changing the stmt.
+ * tree-outof-ssa.c (rewrite_trees): Call modify_stmt only if not
+ removing the stmt.
+ * tree-ssa-ccp.c (substitute_and_fold): Call modify_stmt after changing
+ the stmt, and only if needed.
+ * tree-ssa-dom.c (thread_across_edge): Pass no annotation for a dummy
+ expression.
+ (simplify_rhs_and_lookup_avail_expr): Don't take an annotation param.
+ (simplify_cond_and_lookup_avail_expr): Use modify_stmt.
+ (simplify_switch_and_lookup_avail_expr): Don't take an annotation param.
+ (eliminate_redundant_computations): Don't pass an annotation. Call
+ modify_stmt rather than setting the annotation directly.
+ (record_equivalences_from_stmt): Remove unused local 'j'.
+ (cprop_operand): Take a stmt rather than an annotation as a parameter.
+ Call modify_stmt.
+ (cprop_into_stmt): Pass stmt rather than annotation.
+ (update_rhs_and_lookup_avail_expr): Call modify_stmt.
+ * tree-ssa-loop-im.c (schedule_sm): Call get_stmt_ann rather than
+ modify_stmt.
+ * tree-ssa.c (propagate_into_addr): Dont call modify_stmt.
+
2004-08-10 Jason Merrill <jason@redhat.com>
PR middle-end/16948
tree stmt = bsi_stmt (*bsi);
tree type;
- modify_stmt (stmt);
if (TREE_CODE (stmt) == RETURN_EXPR)
stmt = TREE_OPERAND (stmt, 0);
type = TREE_TYPE (TREE_OPERAND (stmt, 1));
TREE_OPERAND (stmt, 1) = build (COMPLEX_EXPR, type, r, i);
+ modify_stmt (stmt);
}
/* Expand complex addition to scalars:
expand_complex_comparison (block_stmt_iterator *bsi, tree ar, tree ai,
tree br, tree bi, enum tree_code code)
{
- tree cr, ci, cc, stmt, type;
+ tree cr, ci, cc, stmt, expr, type;
cr = gimplify_build2 (bsi, code, boolean_type_node, ar, br);
ci = gimplify_build2 (bsi, code, boolean_type_node, ai, bi);
(code == EQ_EXPR ? TRUTH_AND_EXPR : TRUTH_OR_EXPR),
boolean_type_node, cr, ci);
- stmt = bsi_stmt (*bsi);
- modify_stmt (stmt);
+ stmt = expr = bsi_stmt (*bsi);
switch (TREE_CODE (stmt))
{
case RETURN_EXPR:
- stmt = TREE_OPERAND (stmt, 0);
+ expr = TREE_OPERAND (stmt, 0);
/* FALLTHRU */
case MODIFY_EXPR:
- type = TREE_TYPE (TREE_OPERAND (stmt, 1));
- TREE_OPERAND (stmt, 1) = fold_convert (type, cc);
+ type = TREE_TYPE (TREE_OPERAND (expr, 1));
+ TREE_OPERAND (expr, 1) = fold_convert (type, cc);
break;
case COND_EXPR:
TREE_OPERAND (stmt, 0) = cc;
default:
abort ();
}
+
+ modify_stmt (stmt);
}
/* Process one statement. If we identify a complex operation, expand it. */
static void record_dominating_conditions (tree, varray_type *);
static void record_const_or_copy (tree, tree, varray_type *);
static void record_equality (tree, tree, varray_type *);
-static tree update_rhs_and_lookup_avail_expr (tree, tree, varray_type *,
- stmt_ann_t, bool);
+static tree update_rhs_and_lookup_avail_expr (tree, tree, varray_type *, bool);
static tree simplify_rhs_and_lookup_avail_expr (struct dom_walk_data *,
- tree, stmt_ann_t, int);
+ tree, int);
static tree simplify_cond_and_lookup_avail_expr (tree, varray_type *,
stmt_ann_t, int);
-static tree simplify_switch_and_lookup_avail_expr (tree, varray_type *,
- stmt_ann_t, int);
+static tree simplify_switch_and_lookup_avail_expr (tree, varray_type *, int);
static tree find_equivalent_equality_comparison (tree);
static void record_range (tree, basic_block, varray_type *);
static bool extract_range_from_cond (tree, tree *, tree *, int *);
cached_lhs = lookup_avail_expr (dummy_cond, NULL, false);
if (!cached_lhs || ! is_gimple_min_invariant (cached_lhs))
{
- stmt_ann_t ann = get_stmt_ann (dummy_cond);
cached_lhs = simplify_cond_and_lookup_avail_expr (dummy_cond,
NULL,
- ann,
+ NULL,
false);
}
}
static tree
simplify_rhs_and_lookup_avail_expr (struct dom_walk_data *walk_data,
- tree stmt,
- stmt_ann_t ann,
- int insert)
+ tree stmt, int insert)
{
tree rhs = TREE_OPERAND (stmt, 1);
enum tree_code rhs_code = TREE_CODE (rhs);
result = update_rhs_and_lookup_avail_expr (stmt,
rhs_def_operand,
&bd->avail_exprs,
- ann,
insert);
}
}
&& TREE_CODE (TREE_OPERAND (t, 0)) == SSA_NAME
&& is_gimple_val (TREE_OPERAND (t, 1))))
result = update_rhs_and_lookup_avail_expr
- (stmt, t, &bd->avail_exprs, ann, insert);
+ (stmt, t, &bd->avail_exprs, insert);
}
}
}
op1, integer_one_node)));
result = update_rhs_and_lookup_avail_expr (stmt, t,
- &bd->avail_exprs,
- ann, insert);
+ &bd->avail_exprs, insert);
}
}
t = op;
result = update_rhs_and_lookup_avail_expr (stmt, t,
- &bd->avail_exprs,
- ann, insert);
+ &bd->avail_exprs, insert);
}
}
if (t)
result = update_rhs_and_lookup_avail_expr (stmt, t,
- &bd->avail_exprs,
- ann, insert);
+ &bd->avail_exprs, insert);
}
return result;
/* Update the statement to use the new equivalent
condition. */
COND_EXPR_COND (stmt) = new_cond;
- ann->modified = 1;
+
+ /* If this is not a real stmt, ann will be NULL and we
+ avoid processing the operands. */
+ if (ann)
+ modify_stmt (stmt);
/* Lookup the condition and return its known value if it
exists. */
static tree
simplify_switch_and_lookup_avail_expr (tree stmt,
varray_type *block_avail_exprs_p,
- stmt_ann_t ann,
int insert)
{
tree cond = SWITCH_COND (stmt);
if (!fail)
{
SWITCH_COND (stmt) = def;
- ann->modified = 1;
+ modify_stmt (stmt);
return lookup_avail_expr (stmt, block_avail_exprs_p, insert);
}
if (! cached_lhs && TREE_CODE (stmt) == MODIFY_EXPR)
cached_lhs = simplify_rhs_and_lookup_avail_expr (walk_data,
stmt,
- ann,
insert);
/* Similarly if this is a COND_EXPR and we did not find its
expression in the hash table, simplify the condition and
else if (!cached_lhs && TREE_CODE (stmt) == SWITCH_EXPR)
cached_lhs = simplify_switch_and_lookup_avail_expr (stmt,
&bd->avail_exprs,
- ann,
insert);
opt_stats.num_exprs_considered++;
retval = true;
propagate_tree_value (expr_p, cached_lhs);
- ann->modified = 1;
+ modify_stmt (stmt);
}
return retval;
}
CONST_AND_COPIES. */
static bool
-cprop_operand (stmt_ann_t ann, use_operand_p op_p, varray_type const_and_copies)
+cprop_operand (tree stmt, use_operand_p op_p, varray_type const_and_copies)
{
bool may_have_exposed_new_symbols = false;
tree val;
/* And note that we modified this statement. This is now
safe, even if we changed virtual operands since we will
rescan the statement and rewrite its operands again. */
- ann->modified = 1;
+ modify_stmt (stmt);
}
return may_have_exposed_new_symbols;
}
use_operand_p op_p = USE_OP_PTR (uses, i);
if (TREE_CODE (USE_FROM_PTR (op_p)) == SSA_NAME)
may_have_exposed_new_symbols
- |= cprop_operand (ann, op_p, const_and_copies);
+ |= cprop_operand (stmt, op_p, const_and_copies);
}
vuses = VUSE_OPS (ann);
use_operand_p op_p = VUSE_OP_PTR (vuses, i);
if (TREE_CODE (USE_FROM_PTR (op_p)) == SSA_NAME)
may_have_exposed_new_symbols
- |= cprop_operand (ann, op_p, const_and_copies);
+ |= cprop_operand (stmt, op_p, const_and_copies);
}
v_may_defs = V_MAY_DEF_OPS (ann);
use_operand_p op_p = V_MAY_DEF_OP_PTR (v_may_defs, i);
if (TREE_CODE (USE_FROM_PTR (op_p)) == SSA_NAME)
may_have_exposed_new_symbols
- |= cprop_operand (ann, op_p, const_and_copies);
+ |= cprop_operand (stmt, op_p, const_and_copies);
}
return may_have_exposed_new_symbols;
}
static tree
update_rhs_and_lookup_avail_expr (tree stmt, tree new_rhs,
varray_type *block_avail_exprs_p,
- stmt_ann_t ann,
bool insert)
{
tree cached_lhs = NULL;
/* And make sure we record the fact that we modified this
statement. */
- ann->modified = 1;
+ modify_stmt (stmt);
return cached_lhs;
}