[Bug tree-optimization/83253] -ftree-slsr causes performance regression
wschmidt at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Dec 12 22:48:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83253
--- Comment #5 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
Here's an untested patch (bootstraps successfully but regtest is still
ongoing):
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_CODE (first_dep->stride) == INTEGER_CST)
+ {
+ HOST_WIDE_INT hwi_stride = tree_to_shwi (first_dep->stride);
+ repl_savings = (mult_by_coeff_cost (hwi_stride, mode, speed)
+ - add_cost (speed, mode));
+ }
+ else
+ repl_savings = mul_cost (speed, mode) - add_cost (speed, mode);
+
if (speed)
cost = lowest_cost_path (cost, repl_savings, first_dep,
incr_vec[i].incr, COUNT_PHIS);
OP, since you have confirmed the problem on a number of targets, would you be
willing to try this patch on a couple of them and see whether it solves it?
Otherwise I can build some crosses later this week.
Thanks!
More information about the Gcc-bugs
mailing list