This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/83253] -ftree-slsr causes performance regression


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...

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]