return NULL;
}
-/* STMT is a COND_EXPR
+/* EXPR is a COND_EXPR
+ STMT is the statement containing EXPR.
This routine attempts to find equivalent forms of the condition
which we may be able to optimize better. */
static void
-simplify_cond (tree stmt)
+simplify_cond (tree cond_expr, tree stmt)
{
- tree cond = COND_EXPR_COND (stmt);
+ tree cond = COND_EXPR_COND (cond_expr);
if (COMPARISON_CLASS_P (cond))
{
if (new_cond)
{
- COND_EXPR_COND (stmt) = new_cond;
+ COND_EXPR_COND (cond_expr) = new_cond;
update_stmt (stmt);
}
}
times as possible. */
static void
-forward_propagate_into_cond (tree cond_expr)
+forward_propagate_into_cond (tree cond_expr, tree stmt)
{
gcc_assert (TREE_CODE (cond_expr) == COND_EXPR);
}
COND_EXPR_COND (cond_expr) = new_cond;
- update_stmt (cond_expr);
+ update_stmt (stmt);
if (has_zero_uses (test_var))
{
against a constant where the SSA_NAME is the result of a
conversion. Perhaps this should be folded into the rest
of the COND_EXPR simplification code. */
- simplify_cond (cond_expr);
+ simplify_cond (cond_expr, stmt);
}
/* We've just substituted an ADDR_EXPR into stmt. Update all the
simplify_not_neg_expr (stmt);
bsi_next (&bsi);
}
+ else if (TREE_CODE (rhs) == COND_EXPR)
+ {
+ forward_propagate_into_cond (rhs, stmt);
+ bsi_next (&bsi);
+ }
else
bsi_next (&bsi);
}
}
else if (TREE_CODE (stmt) == COND_EXPR)
{
- forward_propagate_into_cond (stmt);
+ forward_propagate_into_cond (stmt, stmt);
bsi_next (&bsi);
}
else
}
if (cfg_changed)
- cleanup_tree_cfg ();
+ todoflags |= TODO_cleanup_cfg;
return todoflags;
}
NULL, /* next */
0, /* static_pass_number */
TV_TREE_FORWPROP, /* tv_id */
- PROP_cfg | PROP_ssa
- | PROP_alias, /* properties_required */
+ PROP_cfg | PROP_ssa, /* properties_required */
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */