This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/83253] -ftree-slsr causes performance regression
- From: "wschmidt at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 13 Dec 2017 20:47:36 +0000
- Subject: [Bug tree-optimization/83253] -ftree-slsr causes performance regression
- Auto-submitted: auto-generated
- References: <bug-83253-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83253
--- Comment #8 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
Revised patch:
Index: gcc/gimple-ssa-strength-reduction.c
===================================================================
--- gcc/gimple-ssa-strength-reduction.c (revision 255588)
+++ gcc/gimple-ssa-strength-reduction.c (working copy)
@@ -3083,7 +3083,17 @@ analyze_increments (slsr_cand_t first_dep, machine
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);
mikulas@..., please let me know whether you can test this sometime. Otherwise
I should be able to get to it over the rapidly approaching holidays...