Use this version when not const/copy propagating values. For example,
PRE uses this version when building expressions as they would appear
- in specific blocks taking into account actions of PHI nodes. */
+ in specific blocks taking into account actions of PHI nodes.
+
+ The statement in which an expression has been replaced should be
+ folded using fold_stmt_inplace. */
void
replace_exp (use_operand_p op_p, tree val)
void
propagate_tree_value (tree *op_p, tree val)
{
-#if defined ENABLE_CHECKING
- gcc_assert (!(TREE_CODE (val) == SSA_NAME
- && *op_p
- && TREE_CODE (*op_p) == SSA_NAME
- && !may_propagate_copy (*op_p, val)));
-#endif
+ gcc_checking_assert (!(TREE_CODE (val) == SSA_NAME
+ && *op_p
+ && TREE_CODE (*op_p) == SSA_NAME
+ && !may_propagate_copy (*op_p, val)));
if (TREE_CODE (val) == SSA_NAME)
*op_p = val;
else if (gimple_code (stmt) == GIMPLE_COND)
{
tree lhs = NULL_TREE;
- tree rhs = fold_convert (TREE_TYPE (val), integer_zero_node);
+ tree rhs = build_zero_cst (TREE_TYPE (val));
propagate_tree_value (&lhs, val);
gimple_cond_set_code (stmt, NE_EXPR);
gimple_cond_set_lhs (stmt, lhs);
duplicate_ssa_name_ptr_info (copy_of[i].value, SSA_NAME_PTR_INFO (var));
}
- substitute_and_fold (get_value, NULL, true);
+ /* Don't do DCE if we have loops. That's the simplest way to not
+ destroy the scev cache. */
+ substitute_and_fold (get_value, NULL, !current_loops);
free (copy_of);
}