diff options
Diffstat (limited to 'gcc/tree-ssa-reassoc.c')
-rw-r--r-- | gcc/tree-ssa-reassoc.c | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index 1438db84d5b..df99f0dea67 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -1338,7 +1338,7 @@ build_and_add_sum (tree type, tree op1, tree op2, enum tree_code opcode) gimple op1def = NULL, op2def = NULL; gimple_stmt_iterator gsi; tree op; - gimple sum; + gassign *sum; /* Create the addition statement. */ op = make_ssa_name (type, NULL); @@ -2787,7 +2787,7 @@ suitable_cond_bb (basic_block bb, basic_block test_bb, basic_block *other_bb, edge_iterator ei, ei2; edge e, e2; gimple stmt; - gimple_stmt_iterator gsi; + gphi_iterator gsi; bool other_edge_seen = false; bool is_cond; @@ -2849,7 +2849,7 @@ suitable_cond_bb (basic_block bb, basic_block test_bb, basic_block *other_bb, e2 = find_edge (test_bb, *other_bb); for (gsi = gsi_start_phis (e->dest); !gsi_end_p (gsi); gsi_next (&gsi)) { - gimple phi = gsi_stmt (gsi); + gphi *phi = gsi.phi (); /* If both BB and TEST_BB end with GIMPLE_COND, all PHI arguments corresponding to BB and TEST_BB predecessor must be the same. */ if (!operand_equal_p (gimple_phi_arg_def (phi, e->dest_idx), @@ -3000,8 +3000,8 @@ update_ops (tree var, enum tree_code code, vec<operand_entry_t> ops, { gimple_stmt_iterator gsi = gsi_for_stmt (stmt); var = make_ssa_name (TREE_TYPE (var), NULL); - gimple g = gimple_build_assign_with_ops (gimple_assign_rhs_code (stmt), - var, rhs[2], rhs[3]); + gassign *g = gimple_build_assign_with_ops (gimple_assign_rhs_code (stmt), + var, rhs[2], rhs[3]); gimple_set_uid (g, gimple_uid (stmt)); gimple_set_visited (g, true); gsi_insert_before (&gsi, g, GSI_SAME_STMT); @@ -3299,7 +3299,7 @@ maybe_optimize_range_tests (gimple stmt) tree new_lhs = make_ssa_name (TREE_TYPE (lhs), NULL); enum tree_code rhs_code = gimple_assign_rhs_code (cast_stmt); - gimple g; + gassign *g; if (is_gimple_min_invariant (new_op)) { new_op = fold_convert (TREE_TYPE (lhs), new_op); @@ -3333,18 +3333,19 @@ maybe_optimize_range_tests (gimple stmt) && bbinfo[idx].op == NULL_TREE && ops[bbinfo[idx].first_idx]->op != NULL_TREE) { - stmt = last_stmt (bb); + gcond *cond_stmt = as_a <gcond *> (last_stmt (bb)); if (integer_zerop (ops[bbinfo[idx].first_idx]->op)) - gimple_cond_make_false (stmt); + gimple_cond_make_false (cond_stmt); else if (integer_onep (ops[bbinfo[idx].first_idx]->op)) - gimple_cond_make_true (stmt); + gimple_cond_make_true (cond_stmt); else { - gimple_cond_set_code (stmt, NE_EXPR); - gimple_cond_set_lhs (stmt, ops[bbinfo[idx].first_idx]->op); - gimple_cond_set_rhs (stmt, boolean_false_node); + gimple_cond_set_code (cond_stmt, NE_EXPR); + gimple_cond_set_lhs (cond_stmt, + ops[bbinfo[idx].first_idx]->op); + gimple_cond_set_rhs (cond_stmt, boolean_false_node); } - update_stmt (stmt); + update_stmt (cond_stmt); } if (bb == first_bb) break; @@ -3360,6 +3361,7 @@ static bool is_phi_for_stmt (gimple stmt, tree operand) { gimple def_stmt; + gphi *def_phi; tree lhs; use_operand_p arg_p; ssa_op_iter i; @@ -3370,10 +3372,11 @@ is_phi_for_stmt (gimple stmt, tree operand) lhs = gimple_assign_lhs (stmt); def_stmt = SSA_NAME_DEF_STMT (operand); - if (gimple_code (def_stmt) != GIMPLE_PHI) + def_phi = dyn_cast <gphi *> (def_stmt); + if (!def_phi) return false; - FOR_EACH_PHI_ARG (arg_p, def_stmt, i, SSA_OP_USE) + FOR_EACH_PHI_ARG (arg_p, def_phi, i, SSA_OP_USE) if (lhs == USE_FROM_PTR (arg_p)) return true; return false; @@ -3686,7 +3689,7 @@ get_reassociation_width (int ops_num, enum tree_code opc, parallel. */ static void -rewrite_expr_tree_parallel (gimple stmt, int width, +rewrite_expr_tree_parallel (gassign *stmt, int width, vec<operand_entry_t> ops) { enum tree_code opcode = gimple_assign_rhs_code (stmt); @@ -4828,7 +4831,8 @@ reassociate_bb (basic_block bb) if (width > 1 && ops.length () > 3) - rewrite_expr_tree_parallel (stmt, width, ops); + rewrite_expr_tree_parallel (as_a <gassign *> (stmt), + width, ops); else { /* When there are three operands left, we want @@ -4935,7 +4939,7 @@ branch_fixup (void) else gcc_unreachable (); tree lhs = gimple_assign_lhs (use_stmt); - gimple phi = create_phi_node (lhs, merge_bb); + gphi *phi = create_phi_node (lhs, merge_bb); add_phi_arg (phi, build_one_cst (TREE_TYPE (lhs)), etrue, loc); add_phi_arg (phi, othervar, single_succ_edge (then_bb), loc); gsi = gsi_for_stmt (use_stmt); |