Comments

Here's a new version of the main strength reduction patch, addressing
previous comments. A couple of quick notes:
* I opened PR53773 and PR53774 for the cases where commutative
operations were encountered with a constant in rhs1. This version of
the patch still has the gcc_asserts in place to catch those cases, but
I'll plan to remove those once the patch is approved.
* You previously asked:
>>>> +static slsr_cand_t>> +base_cand_from_table (tree base_in)>> +{>> + slsr_cand mapping_key;>> +>> + gimple def = SSA_NAME_DEF_STMT (base_in);>> + if (!def)>> + return (slsr_cand_t) NULL;>> +>> + mapping_key.cand_stmt = def;>> + return (slsr_cand_t) htab_find (stmt_cand_map, &mapping_key);>>>> isn't that reachable via the base-name -> chain mapping for base_in?
I had to review this a bit, but the answer is no. If you look at one of
the algebraic manipulations in create_mul_ssa_cand as an example,
base_in corresponds to Y. base_cand_from_table is looking for a
candidate that has Y for its LHS. The base-name -> chain mapping is
used to find all candidates that have B as the base_name.
* I added a detailed explanation of what's going on with legal_cast_p.
Hopefully this will be easier to understand now.
I've bootstrapped this on powerpc64-unknown-linux-gnu with three new
regressions (for which I opened the two bug reports). Ok for trunk
after removing the asserts?
Thanks,
Bill
gcc:
2012-06-25 Bill Schmidt <wschmidt@linux.ibm.com>
* tree-pass.h (pass_strength_reduction): New decl.
* tree-ssa-loop-ivopts.c (initialize_costs): Make non-static.
(finalize_costs): Likewise.
* timevar.def (TV_TREE_SLSR): New timevar.
* gimple-ssa-strength-reduction.c: New.
* tree-flow.h (initialize_costs): New decl.
(finalize_costs): Likewise.
* Makefile.in (tree-ssa-strength-reduction.o): New dependencies.
* passes.c (init_optimization_passes): Add pass_strength_reduction.
gcc/testsuite:
2012-06-25 Bill Schmidt <wschmidt@linux.ibm.com>
* gcc.dg/tree-ssa/slsr-1.c: New test.
* gcc.dg/tree-ssa/slsr-2.c: Likewise.
* gcc.dg/tree-ssa/slsr-3.c: Likewise.
* gcc.dg/tree-ssa/slsr-4.c: Likewise.