Commit 113ab41c by Richard Guenther Committed by Richard Biener

tree-ssa-forwprop.c (forward_propagate_into_cond): Keep track if we simplified anything.

2007-04-27  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-forwprop.c (forward_propagate_into_cond): Keep track
	if we simplified anything.
	(tree_ssa_forward_propagate_single_use_vars): Defer overflow
	warnings until we did a simplification and the stmt was not
	marked as TREE_NO_WARNING.

From-SVN: r124242
parent bfa45564
2007-04-27 Richard Guenther <rguenther@suse.de>
* tree-ssa-forwprop.c (forward_propagate_into_cond): Keep track
if we simplified anything.
(tree_ssa_forward_propagate_single_use_vars): Defer overflow
warnings until we did a simplification and the stmt was not
marked as TREE_NO_WARNING.
2007-04-27 Mike Stump <mrs@apple.com> 2007-04-27 Mike Stump <mrs@apple.com>
* config/rs6000/darwin.h (ALWAYS_PUSH_CONSTS_USING_REGS_P): Remove. * config/rs6000/darwin.h (ALWAYS_PUSH_CONSTS_USING_REGS_P): Remove.
......
...@@ -372,9 +372,11 @@ combine_cond_expr_cond (enum tree_code code, tree type, ...@@ -372,9 +372,11 @@ combine_cond_expr_cond (enum tree_code code, tree type,
/* Propagate from the ssa name definition statements of COND_EXPR /* Propagate from the ssa name definition statements of COND_EXPR
in statement STMT into the conditional if that simplifies it. */ in statement STMT into the conditional if that simplifies it. */
static void static bool
forward_propagate_into_cond (tree cond_expr, tree stmt) forward_propagate_into_cond (tree cond_expr, tree stmt)
{ {
bool did_something = false;
do { do {
tree tmp = NULL_TREE; tree tmp = NULL_TREE;
tree cond = COND_EXPR_COND (cond_expr); tree cond = COND_EXPR_COND (cond_expr);
...@@ -407,7 +409,7 @@ forward_propagate_into_cond (tree cond_expr, tree stmt) ...@@ -407,7 +409,7 @@ forward_propagate_into_cond (tree cond_expr, tree stmt)
def_stmt = get_prop_source_stmt (name, false, &single_use_p); def_stmt = get_prop_source_stmt (name, false, &single_use_p);
if (def_stmt == NULL_TREE if (def_stmt == NULL_TREE
|| !can_propagate_from (def_stmt)) || !can_propagate_from (def_stmt))
return; return did_something;
rhs = GIMPLE_STMT_OPERAND (def_stmt, 1); rhs = GIMPLE_STMT_OPERAND (def_stmt, 1);
tmp = combine_cond_expr_cond (TREE_CODE (cond), boolean_type_node, tmp = combine_cond_expr_cond (TREE_CODE (cond), boolean_type_node,
...@@ -422,7 +424,7 @@ forward_propagate_into_cond (tree cond_expr, tree stmt) ...@@ -422,7 +424,7 @@ forward_propagate_into_cond (tree cond_expr, tree stmt)
def_stmt = get_prop_source_stmt (name, true, NULL); def_stmt = get_prop_source_stmt (name, true, NULL);
if (def_stmt == NULL_TREE if (def_stmt == NULL_TREE
|| !can_propagate_from (def_stmt)) || !can_propagate_from (def_stmt))
return; return did_something;
rhs = GIMPLE_STMT_OPERAND (def_stmt, 1); rhs = GIMPLE_STMT_OPERAND (def_stmt, 1);
tmp = combine_cond_expr_cond (NE_EXPR, boolean_type_node, rhs, tmp = combine_cond_expr_cond (NE_EXPR, boolean_type_node, rhs,
...@@ -447,12 +449,16 @@ forward_propagate_into_cond (tree cond_expr, tree stmt) ...@@ -447,12 +449,16 @@ forward_propagate_into_cond (tree cond_expr, tree stmt)
/* Remove defining statements. */ /* Remove defining statements. */
remove_prop_source_from_use (name, NULL); remove_prop_source_from_use (name, NULL);
did_something = true;
/* Continue combining. */ /* Continue combining. */
continue; continue;
} }
break; break;
} while (1); } while (1);
return did_something;
} }
/* We've just substituted an ADDR_EXPR into stmt. Update all the /* We've just substituted an ADDR_EXPR into stmt. Update all the
...@@ -986,7 +992,11 @@ tree_ssa_forward_propagate_single_use_vars (void) ...@@ -986,7 +992,11 @@ tree_ssa_forward_propagate_single_use_vars (void)
} }
else if (TREE_CODE (rhs) == COND_EXPR) else if (TREE_CODE (rhs) == COND_EXPR)
{ {
forward_propagate_into_cond (rhs, stmt); bool did_something;
fold_defer_overflow_warnings ();
did_something = forward_propagate_into_cond (rhs, stmt);
fold_undefer_overflow_warnings (!TREE_NO_WARNING (rhs)
&& did_something, stmt, WARN_STRICT_OVERFLOW_CONDITIONAL);
bsi_next (&bsi); bsi_next (&bsi);
} }
else if (COMPARISON_CLASS_P (rhs)) else if (COMPARISON_CLASS_P (rhs))
...@@ -1010,7 +1020,12 @@ tree_ssa_forward_propagate_single_use_vars (void) ...@@ -1010,7 +1020,12 @@ tree_ssa_forward_propagate_single_use_vars (void)
} }
else if (TREE_CODE (stmt) == COND_EXPR) else if (TREE_CODE (stmt) == COND_EXPR)
{ {
forward_propagate_into_cond (stmt, stmt); bool did_something;
fold_defer_overflow_warnings ();
did_something = forward_propagate_into_cond (stmt, stmt);
fold_undefer_overflow_warnings (!TREE_NO_WARNING (stmt)
&& did_something, stmt,
WARN_STRICT_OVERFLOW_CONDITIONAL);
bsi_next (&bsi); bsi_next (&bsi);
} }
else else
......
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