summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-forwprop.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2007-06-06 13:58:41 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2007-06-06 13:58:41 +0000
commit4c580c8cd630886cae63a8d75f0576666d52267e (patch)
treef0957cdcca67da1826ca1fe5ed55eaeb8d988fef /gcc/tree-ssa-forwprop.c
parent0f6782a317d1cc2d79fcd44b8486dbee74b7af9f (diff)
downloadgcc-4c580c8cd630886cae63a8d75f0576666d52267e.tar.gz
2007-06-06 Richard Guenther <rguenther@suse.de>
* tree-ssa-forwprop.c (forward_propagate_into_cond): Return 2 if we need to schedule cfg_cleanup. (tree_ssa_forward_propagate_single_use_vars): Do so. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@125490 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-forwprop.c')
-rw-r--r--gcc/tree-ssa-forwprop.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index e42406c3ed6..967a824e9c7 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -370,12 +370,14 @@ 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. */
+ in statement STMT into the conditional if that simplifies it.
+ Returns zero if no statement was changed, one if there were
+ changes and two if cfg_cleanup needs to run. */
-static bool
+static int
forward_propagate_into_cond (tree cond_expr, tree stmt)
{
- bool did_something = false;
+ int did_something = 0;
do {
tree tmp = NULL_TREE;
@@ -449,7 +451,10 @@ forward_propagate_into_cond (tree cond_expr, tree stmt)
/* Remove defining statements. */
remove_prop_source_from_use (name, NULL);
- did_something = true;
+ if (is_gimple_min_invariant (tmp))
+ did_something = 2;
+ else if (did_something == 0)
+ did_something = 1;
/* Continue combining. */
continue;
@@ -1014,9 +1019,11 @@ tree_ssa_forward_propagate_single_use_vars (void)
}
else if (TREE_CODE (rhs) == COND_EXPR)
{
- bool did_something;
+ int did_something;
fold_defer_overflow_warnings ();
did_something = forward_propagate_into_cond (rhs, stmt);
+ if (did_something == 2)
+ cfg_changed = true;
fold_undefer_overflow_warnings (!TREE_NO_WARNING (rhs)
&& did_something, stmt, WARN_STRICT_OVERFLOW_CONDITIONAL);
bsi_next (&bsi);
@@ -1042,9 +1049,11 @@ tree_ssa_forward_propagate_single_use_vars (void)
}
else if (TREE_CODE (stmt) == COND_EXPR)
{
- bool did_something;
+ int did_something;
fold_defer_overflow_warnings ();
did_something = forward_propagate_into_cond (stmt, stmt);
+ if (did_something == 2)
+ cfg_changed = true;
fold_undefer_overflow_warnings (!TREE_NO_WARNING (stmt)
&& did_something, stmt,
WARN_STRICT_OVERFLOW_CONDITIONAL);