diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-04-27 21:50:04 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-04-27 21:50:04 +0000 |
commit | d080be9e8e4f369de29217271e3389a22af79715 (patch) | |
tree | 38c60ebe4613071684a8bf4936b1a59787dd94a0 /gcc/tree-ssa-forwprop.c | |
parent | 44dc7eda2781a0555b677692bb997500c7528ac2 (diff) | |
download | gcc-d080be9e8e4f369de29217271e3389a22af79715.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124242 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-forwprop.c')
-rw-r--r-- | gcc/tree-ssa-forwprop.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c index 6d9a4678bb4..860a4c4da68 100644 --- a/gcc/tree-ssa-forwprop.c +++ b/gcc/tree-ssa-forwprop.c @@ -372,9 +372,11 @@ combine_cond_expr_cond (enum tree_code code, tree type, /* Propagate from the ssa name definition statements of COND_EXPR in statement STMT into the conditional if that simplifies it. */ -static void +static bool forward_propagate_into_cond (tree cond_expr, tree stmt) { + bool did_something = false; + do { tree tmp = NULL_TREE; tree cond = COND_EXPR_COND (cond_expr); @@ -407,7 +409,7 @@ forward_propagate_into_cond (tree cond_expr, tree stmt) def_stmt = get_prop_source_stmt (name, false, &single_use_p); if (def_stmt == NULL_TREE || !can_propagate_from (def_stmt)) - return; + return did_something; rhs = GIMPLE_STMT_OPERAND (def_stmt, 1); tmp = combine_cond_expr_cond (TREE_CODE (cond), boolean_type_node, @@ -422,7 +424,7 @@ forward_propagate_into_cond (tree cond_expr, tree stmt) def_stmt = get_prop_source_stmt (name, true, NULL); if (def_stmt == NULL_TREE || !can_propagate_from (def_stmt)) - return; + return did_something; rhs = GIMPLE_STMT_OPERAND (def_stmt, 1); tmp = combine_cond_expr_cond (NE_EXPR, boolean_type_node, rhs, @@ -447,12 +449,16 @@ forward_propagate_into_cond (tree cond_expr, tree stmt) /* Remove defining statements. */ remove_prop_source_from_use (name, NULL); + did_something = true; + /* Continue combining. */ continue; } break; } while (1); + + return did_something; } /* We've just substituted an ADDR_EXPR into stmt. Update all the @@ -986,7 +992,11 @@ tree_ssa_forward_propagate_single_use_vars (void) } 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); } else if (COMPARISON_CLASS_P (rhs)) @@ -1010,7 +1020,12 @@ tree_ssa_forward_propagate_single_use_vars (void) } 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); } else |