http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52272

Igor Zamyatin <izamyatin at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |izamyatin at gmail dot com

--- Comment #8 from Igor Zamyatin <izamyatin at gmail dot com> 2012-03-26 
11:05:52 UTC ---
Sort of experimental patch

Index: tree-ssa-loop-ivopts.c
===================================================================
--- tree-ssa-loop-ivopts.c      (revision 185039)
+++ tree-ssa-loop-ivopts.c      (working copy)
@@ -4114,6 +4114,7 @@
   else if (ratio == 1)
     {
       tree real_cbase = cbase;
+      int diff_cost, add_cost1;

       /* Check to see if any adjustment is needed.  */
       if (cstepi == 0 && stmt_is_after_inc)
@@ -4133,7 +4134,10 @@
                              ubase, real_cbase,
                              &symbol_present, &var_present, &offset,
                              depends_on);
+      diff_cost = cost.cost;
       cost.cost /= avg_loop_niter (data->current_loop);
+      if (diff_cost > (add_cost1 = add_cost(TYPE_MODE (ctype), data->speed)))
+          cost.cost += add_cost1;
     }
   else if (address_p
           && !POINTER_TYPE_P (ctype)


 It was found during some side investigation regarding ivopts phase work. 
Patch fixes the regression.

Reply via email to