On Mon, May 6, 2013 at 5:42 PM, Bill Schmidt <wschm...@linux.vnet.ibm.com> wrote: > This removes lazy_create_slsr_reg and replaces uses of make_ssa_name > with make_temp_ssa_name, removing the need for a bunch of unnecessary > vars. > > Bootstrapped and tested on powerpc64-unknown-linux-gnu with no new > regressions. Ok for trunk?
Ok. Thanks, Richard. > Thanks, > Bill > > > 2013-05-06 Bill Schmidt <wschm...@linux.vnet.ibm.com> > > * gimple-ssa-strength-reduction.c (lazy_create_slsr_reg): Remove. > (replace_mult_candidate): Remove unnecessary argument; remove > unnecessary parameter from call to introduce_cast_before_cand. > (replace_unconditional_candidate): Remove unnecessary parameter > from call to replace_mult_candidate. > (replace_conditional_candidate): Likewise. > (insert_initializers): Use make_temp_ssa_name. > (introduce_cast_before_cand): Remove unnecessary argument; use > make_temp_ssa_name. > (replace_one_candidate): Remove unnecessary argument; remove > unnecessary parameter from calls to introduce_cast_before_cand. > (replace_profitable_candidates): Remove unnecessary parameters > from calls to replace_one_candidate. > > > Index: gcc/gimple-ssa-strength-reduction.c > =================================================================== > --- gcc/gimple-ssa-strength-reduction.c (revision 198627) > +++ gcc/gimple-ssa-strength-reduction.c (working copy) > @@ -376,7 +376,7 @@ static bool address_arithmetic_p; > > /* Forward function declarations. */ > static slsr_cand_t base_cand_from_table (tree); > -static tree introduce_cast_before_cand (slsr_cand_t, tree, tree, tree*); > +static tree introduce_cast_before_cand (slsr_cand_t, tree, tree); > > /* Produce a pointer to the IDX'th candidate in the candidate vector. */ > > @@ -1818,16 +1818,6 @@ cand_abs_increment (slsr_cand_t c) > return increment; > } > > -/* If *VAR is NULL or is not of a compatible type with TYPE, create a > - new temporary reg of type TYPE and store it in *VAR. */ > - > -static inline void > -lazy_create_slsr_reg (tree *var, tree type) > -{ > - if (!*var || !types_compatible_p (TREE_TYPE (*var), type)) > - *var = create_tmp_reg (type, "slsr"); > -} > - > /* Return TRUE iff candidate C has already been replaced under > another interpretation. */ > > @@ -1841,8 +1831,7 @@ cand_already_replaced (slsr_cand_t c) > replace_conditional_candidate. */ > > static void > -replace_mult_candidate (slsr_cand_t c, tree basis_name, double_int bump, > - tree *var) > +replace_mult_candidate (slsr_cand_t c, tree basis_name, double_int bump) > { > tree target_type = TREE_TYPE (gimple_assign_lhs (c->cand_stmt)); > enum tree_code cand_code = gimple_assign_rhs_code (c->cand_stmt); > @@ -1869,8 +1858,7 @@ static void > /* If the basis name and the candidate's LHS have incompatible > types, introduce a cast. */ > if (!useless_type_conversion_p (target_type, TREE_TYPE (basis_name))) > - basis_name = introduce_cast_before_cand (c, target_type, > - basis_name, var); > + basis_name = introduce_cast_before_cand (c, target_type, basis_name); > if (bump.is_negative ()) > { > code = MINUS_EXPR; > @@ -1945,7 +1933,6 @@ replace_unconditional_candidate (slsr_cand_t c) > { > slsr_cand_t basis; > double_int stride, bump; > - tree var = NULL; > > if (cand_already_replaced (c)) > return; > @@ -1954,7 +1941,7 @@ replace_unconditional_candidate (slsr_cand_t c) > stride = tree_to_double_int (c->stride); > bump = cand_increment (c) * stride; > > - replace_mult_candidate (c, gimple_assign_lhs (basis->cand_stmt), bump, > &var); > + replace_mult_candidate (c, gimple_assign_lhs (basis->cand_stmt), bump); > } > > /* Return the index in the increment vector of the given INCREMENT. */ > @@ -2150,7 +2137,7 @@ create_phi_basis (slsr_cand_t c, gimple from_phi, > static void > replace_conditional_candidate (slsr_cand_t c) > { > - tree basis_name, name, var = NULL; > + tree basis_name, name; > slsr_cand_t basis; > location_t loc; > double_int stride, bump; > @@ -2169,7 +2156,7 @@ replace_conditional_candidate (slsr_cand_t c) > stride = tree_to_double_int (c->stride); > bump = c->index * stride; > > - replace_mult_candidate (c, name, bump, &var); > + replace_mult_candidate (c, name, bump); > } > > /* Compute the expected costs of inserting basis adjustments for > @@ -2925,7 +2912,6 @@ static void > insert_initializers (slsr_cand_t c) > { > unsigned i; > - tree new_var = NULL_TREE; > > for (i = 0; i < incr_vec_len; i++) > { > @@ -2963,8 +2949,7 @@ insert_initializers (slsr_cand_t c) > > /* Create a new SSA name to hold the initializer's value. */ > stride_type = TREE_TYPE (c->stride); > - lazy_create_slsr_reg (&new_var, stride_type); > - new_name = make_ssa_name (new_var, NULL); > + new_name = make_temp_ssa_name (stride_type, NULL, "slsr"); > incr_vec[i].initializer = new_name; > > /* Create the initializer and insert it in the latest possible > @@ -3062,15 +3047,13 @@ all_phi_incrs_profitable (slsr_cand_t c, gimple ph > the new SSA name. */ > > static tree > -introduce_cast_before_cand (slsr_cand_t c, tree to_type, > - tree from_expr, tree *new_var) > +introduce_cast_before_cand (slsr_cand_t c, tree to_type, tree from_expr) > { > tree cast_lhs; > gimple cast_stmt; > gimple_stmt_iterator gsi = gsi_for_stmt (c->cand_stmt); > > - lazy_create_slsr_reg (new_var, to_type); > - cast_lhs = make_ssa_name (*new_var, NULL); > + cast_lhs = make_temp_ssa_name (to_type, NULL, "slsr"); > cast_stmt = gimple_build_assign_with_ops (NOP_EXPR, cast_lhs, > from_expr, NULL_TREE); > gimple_set_location (cast_stmt, gimple_location (c->cand_stmt)); > @@ -3124,8 +3107,7 @@ replace_rhs_if_not_dup (enum tree_code new_code, t > is the rhs1 to use in creating the add/subtract. */ > > static void > -replace_one_candidate (slsr_cand_t c, unsigned i, tree *new_var, > - tree basis_name) > +replace_one_candidate (slsr_cand_t c, unsigned i, tree basis_name) > { > gimple stmt_to_print = NULL; > tree orig_rhs1, orig_rhs2; > @@ -3161,8 +3143,7 @@ static void > rhs2 = incr_vec[i].initializer; > else > rhs2 = introduce_cast_before_cand (c, orig_type, > - incr_vec[i].initializer, > - new_var); > + incr_vec[i].initializer); > > if (incr_vec[i].incr != cand_incr) > { > @@ -3188,7 +3169,7 @@ static void > if (types_compatible_p (orig_type, stride_type)) > rhs2 = c->stride; > else > - rhs2 = introduce_cast_before_cand (c, orig_type, c->stride, new_var); > + rhs2 = introduce_cast_before_cand (c, orig_type, c->stride); > > stmt_to_print = replace_rhs_if_not_dup (repl_code, basis_name, rhs2, > orig_code, orig_rhs1, orig_rhs2, > @@ -3204,7 +3185,7 @@ static void > if (types_compatible_p (orig_type, stride_type)) > rhs2 = c->stride; > else > - rhs2 = introduce_cast_before_cand (c, orig_type, c->stride, new_var); > + rhs2 = introduce_cast_before_cand (c, orig_type, c->stride); > > if (orig_code != MINUS_EXPR > || !operand_equal_p (basis_name, orig_rhs1, 0) > @@ -3270,7 +3251,6 @@ replace_profitable_candidates (slsr_cand_t c) > if (!cand_already_replaced (c)) > { > double_int increment = cand_abs_increment (c); > - tree new_var = NULL; > enum tree_code orig_code = gimple_assign_rhs_code (c->cand_stmt); > unsigned i; > > @@ -3302,14 +3282,14 @@ replace_profitable_candidates (slsr_cand_t c) > > /* Replace C with an add of the new basis phi and the > increment. */ > - replace_one_candidate (c, i, &new_var, name); > + replace_one_candidate (c, i, name); > } > } > else > { > slsr_cand_t basis = lookup_cand (c->basis); > tree basis_name = gimple_assign_lhs (basis->cand_stmt); > - replace_one_candidate (c, i, &new_var, basis_name); > + replace_one_candidate (c, i, basis_name); > } > } > } > >