The following patch should improve code size which degradation for arm is reported on

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

Is it ok to commit? The patch was successfully bootstrapped on x86-64 and i686 with H.J.'s autotester options.

2011-04-13  Vladimir Makarov <vmaka...@redhat.com>

        PR rtl-optimization/48455
        * ira-costs.c (find_costs_and_classes): Use i_mem_cost instead of
        `temp_costs->mem_cost'.





Index: ira-costs.c
===================================================================
--- ira-costs.c (revision 172376)
+++ ira-costs.c (working copy)
@@ -1646,44 +1646,44 @@
                  for (k = cost_classes_ptr->num - 1; k >= 0; k--)
                    {
                      add_cost = a_costs[k];
                      if (add_cost > 0 && INT_MAX - add_cost < i_costs[k])
                        i_costs[k] = INT_MAX;
                      else
                        i_costs[k] += add_cost;
                    }
                  add_cost = COSTS (costs, a_num)->mem_cost;
                  if (add_cost > 0 && INT_MAX - add_cost < i_mem_cost)
                    i_mem_cost = INT_MAX;
                  else
                    i_mem_cost += add_cost;
 #ifdef FORBIDDEN_INC_DEC_CLASSES
                  if (in_inc_dec[a_num])
                    inc_dec_p = true;
 #endif
                }
            }
          if (equiv_savings < 0)
-           temp_costs->mem_cost = -equiv_savings;
+           i_mem_cost = -equiv_savings;
          else if (equiv_savings > 0)
            {
-             temp_costs->mem_cost = 0;
+             i_mem_cost = 0;
              for (k = cost_classes_ptr->num - 1; k >= 0; k--)
                i_costs[k] += equiv_savings;
            }
 
          best_cost = (1 << (HOST_BITS_PER_INT - 2)) - 1;
          best = ALL_REGS;
          alt_class = NO_REGS;
          /* Find best common class for all allocnos with the same
             regno.  */
          for (k = 0; k < cost_classes_ptr->num; k++)
            {
              rclass = cost_classes[k];
              /* Ignore classes that are too small for this operand or
                 invalid for an operand that was auto-incremented.  */
              if (! contains_reg_of_mode[rclass][PSEUDO_REGNO_MODE (i)]
 #ifdef FORBIDDEN_INC_DEC_CLASSES
                  || (inc_dec_p && forbidden_inc_dec_class[rclass])
 #endif
 #ifdef CANNOT_CHANGE_MODE_CLASS
                  || invalid_mode_change_p (i, (enum reg_class) rclass)

Reply via email to