diff options
author | Bill Schmidt <wschmidt@linux.vnet.ibm.com> | 2017-12-14 20:40:21 +0000 |
---|---|---|
committer | William Schmidt <wschmidt@gcc.gnu.org> | 2017-12-14 20:40:21 +0000 |
commit | d5f6f04c914e2742aae068bcc4872af694200681 (patch) | |
tree | bb013d21a9c288daf2b7432bb527993bc1633078 /gcc | |
parent | ae1fa44f167db80e50d6f6cc9833672fe746c059 (diff) | |
download | gcc-d5f6f04c914e2742aae068bcc4872af694200681.zip gcc-d5f6f04c914e2742aae068bcc4872af694200681.tar.gz gcc-d5f6f04c914e2742aae068bcc4872af694200681.tar.bz2 |
gimple-ssa-strength-reduction.c (analyze_increments): Distinguish replacement costs for constant strides from those for unknown strides.
2017-12-14 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
* gimple-ssa-strength-reduction.c (analyze_increments):
Distinguish replacement costs for constant strides from those for
unknown strides.
From-SVN: r255664
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/gimple-ssa-strength-reduction.c | 12 |
2 files changed, 17 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d20a1b4..2e079fa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-12-14 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + * gimple-ssa-strength-reduction.c (analyze_increments): + Distinguish replacement costs for constant strides from those for + unknown strides. + 2017-12-14 Jakub Jelinek <jakub@redhat.com> * var-tracking.c (variable_tracking_main_1): Formatting fix. diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c index b51239b..0f90232 100644 --- a/gcc/gimple-ssa-strength-reduction.c +++ b/gcc/gimple-ssa-strength-reduction.c @@ -3083,7 +3083,17 @@ analyze_increments (slsr_cand_t first_dep, machine_mode mode, bool speed) else if (first_dep->kind == CAND_MULT) { int cost = mult_by_coeff_cost (incr, mode, speed); - int repl_savings = mul_cost (speed, mode) - add_cost (speed, mode); + int repl_savings; + + if (tree_fits_shwi_p (first_dep->stride)) + { + HOST_WIDE_INT hwi_stride = tree_to_shwi (first_dep->stride); + repl_savings = mult_by_coeff_cost (hwi_stride, mode, speed); + } + else + repl_savings = mul_cost (speed, mode); + repl_savings -= add_cost (speed, mode); + if (speed) cost = lowest_cost_path (cost, repl_savings, first_dep, incr_vec[i].incr, COUNT_PHIS); |