diff options
author | Richard Guenther <rguenther@suse.de> | 2011-09-01 11:46:08 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2011-09-01 11:46:08 +0000 |
commit | 4e71066d7ed30ff6582ba01d1cb319787bf1ac5a (patch) | |
tree | de79a98229582fd910a363d796804b194a844d10 /gcc/tree-ssa-forwprop.c | |
parent | dbe36d674a7e0916981fbb8728d4c31d26e84462 (diff) | |
download | gcc-4e71066d7ed30ff6582ba01d1cb319787bf1ac5a.zip gcc-4e71066d7ed30ff6582ba01d1cb319787bf1ac5a.tar.gz gcc-4e71066d7ed30ff6582ba01d1cb319787bf1ac5a.tar.bz2 |
expr.c (expand_expr_real_2): Move COND_EXPR and VEC_COND_EXPR handling here, from ...
2011-08-31 Richard Guenther <rguenther@suse.de>
* expr.c (expand_expr_real_2): Move COND_EXPR and VEC_COND_EXPR
handling here, from ...
(expand_expr_real_1): ... here.
* gimple-pretty-print.c (dump_ternary_rhs): Handle COND_EXPR
and VEC_COND_EXPR.
* gimple.c (gimple_rhs_class_table): Make COND_EXPR and VEC_COND_EXPR
a GIMPLE_TERNARY_RHS.
* tree-cfg.c (verify_gimple_assign_ternary): Handle COND_EXPR
and VEC_COND_EXPR here ...
(verify_gimple_assign_single): ... not here.
* gimple-fold.c (fold_gimple_assign): Move COND_EXPR folding.
* tree-object-size.c (cond_expr_object_size): Adjust.
(collect_object_sizes_for): Likewise.
* tree-scalar-evolution.c (interpret_expr): Don't handle
ternary RHSs.
* tree-ssa-forwprop.c (forward_propagate_into_cond): Fix and
simplify.
(ssa_forward_propagate_and_combine): Adjust.
* tree-ssa-loop-im.c (move_computations_stmt): Build the COND_EXPR
as ternary.
* tree-ssa-threadedge.c (fold_assignment_stmt): Adjust.
* tree-vect-loop.c (vect_is_simple_reduction_1): Likewise.
* tree-vect-stmt.c (vectorizable_condition): Likewise.
* tree-vrp.c (extract_range_from_cond_expr): Likewise.
(extract_range_from_assignment): Likewise.
From-SVN: r178408
Diffstat (limited to 'gcc/tree-ssa-forwprop.c')
-rw-r--r-- | gcc/tree-ssa-forwprop.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c index 7dd5e08..89d6239 100644 --- a/gcc/tree-ssa-forwprop.c +++ b/gcc/tree-ssa-forwprop.c @@ -540,12 +540,9 @@ forward_propagate_into_gimple_cond (gimple stmt) /* Propagate from the ssa name definition statements of COND_EXPR in the rhs of 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. - - This must be kept in sync with forward_propagate_into_gimple_cond. */ + Returns true zero if the stmt was changed. */ -static int +static bool forward_propagate_into_cond (gimple_stmt_iterator *gsi_p) { gimple stmt = gsi_stmt (*gsi_p); @@ -560,15 +557,17 @@ forward_propagate_into_cond (gimple_stmt_iterator *gsi_p) TREE_OPERAND (cond, 1)); else if (TREE_CODE (cond) == SSA_NAME) { - tree name = cond, rhs0; + tree name = cond; gimple def_stmt = get_prop_source_stmt (name, true, NULL); if (!def_stmt || !can_propagate_from (def_stmt)) return 0; - rhs0 = gimple_assign_rhs1 (def_stmt); - tmp = combine_cond_expr_cond (stmt, NE_EXPR, boolean_type_node, rhs0, - build_int_cst (TREE_TYPE (rhs0), 0), - false); + if (TREE_CODE_CLASS (gimple_assign_rhs_code (def_stmt)) == tcc_comparison) + tmp = fold_build2_loc (gimple_location (def_stmt), + gimple_assign_rhs_code (def_stmt), + boolean_type_node, + gimple_assign_rhs1 (def_stmt), + gimple_assign_rhs2 (def_stmt)); } if (tmp) @@ -582,11 +581,16 @@ forward_propagate_into_cond (gimple_stmt_iterator *gsi_p) fprintf (dump_file, "'\n"); } - gimple_assign_set_rhs_from_tree (gsi_p, unshare_expr (tmp)); + if (integer_onep (tmp)) + gimple_assign_set_rhs_from_tree (gsi_p, gimple_assign_rhs2 (stmt)); + else if (integer_zerop (tmp)) + gimple_assign_set_rhs_from_tree (gsi_p, gimple_assign_rhs3 (stmt)); + else + gimple_assign_set_rhs1 (stmt, unshare_expr (tmp)); stmt = gsi_stmt (*gsi_p); update_stmt (stmt); - return is_gimple_min_invariant (tmp) ? 2 : 1; + return true; } return 0; @@ -2436,12 +2440,8 @@ ssa_forward_propagate_and_combine (void) else if (code == COND_EXPR) { /* In this case the entire COND_EXPR is in rhs1. */ - int did_something; - did_something = forward_propagate_into_cond (&gsi); + changed |= forward_propagate_into_cond (&gsi); stmt = gsi_stmt (gsi); - if (did_something == 2) - cfg_changed = true; - changed = did_something != 0; } else if (TREE_CODE_CLASS (code) == tcc_comparison) { |