re PR bootstrap/58933 (IRA ICE in update_costs_from_allocno)
authorVladimir Makarov <vmakarov@redhat.com>
Thu, 31 Oct 2013 03:14:07 +0000 (03:14 +0000)
committerVladimir Makarov <vmakarov@gcc.gnu.org>
Thu, 31 Oct 2013 03:14:07 +0000 (03:14 +0000)
2013-10-30  Vladimir Makarov  <vmakarov@redhat.com>

PR bootstrap/58933
* ira-color.c (update_costs_from_copies): Add new parameter.  Use
it for calling update_costs_from_allocno.
(assign_hard_reg): Call restore_costs_from_copies only for
!retry_p.  Pass new argument to update_costs_from_copies.
(color_pass): Pass new argument to update_costs_from_copies.
(ira_mark_allocation_change): Ditto.

From-SVN: r204245

gcc/ChangeLog
gcc/ira-color.c

index 3b5d9522b4758bbe2b3d2269429e850055fc2586..966b4a5ffe08602564c0bc98c5bd6ea3b86a5ad0 100644 (file)
@@ -1,3 +1,13 @@
+2013-10-30  Vladimir Makarov  <vmakarov@redhat.com>
+
+       PR bootstrap/58933
+       * ira-color.c (update_costs_from_copies): Add new parameter.  Use
+       it for calling update_costs_from_allocno.
+       (assign_hard_reg): Call restore_costs_from_copies only for
+       !retry_p.  Pass new argument to update_costs_from_copies.
+       (color_pass): Pass new argument to update_costs_from_copies.
+       (ira_mark_allocation_change): Ditto.
+
 2013-10-30  Sharad Singhai  <singhai@google.com>
 
        PR middle-end/58134
index a0a62a2c9ad52148b44ff052e1b83b9d2c3157f3..295cd5327d756c4fd167dfb89a916909180ac93b 100644 (file)
@@ -1217,7 +1217,7 @@ static struct update_cost_queue_elem *update_cost_queue_elems;
 static int update_cost_check;
 
 /* Allocate and initialize data necessary for function
-   update_costs_from_copiess.  */
+   update_costs_from_copies.  */
 static void
 initiate_cost_update (void)
 {
@@ -1399,16 +1399,16 @@ update_costs_from_prefs (ira_allocno_t allocno)
 /* Update (decrease if DECR_P) the cost of allocnos connected to
    ALLOCNO through copies to increase chances to remove some copies as
    the result of subsequent assignment.  ALLOCNO was just assigned to
-   a hard register.  */
+   a hard register.  Record cost updates if RECORD_P is true.  */
 static void
-update_costs_from_copies (ira_allocno_t allocno, bool decr_p)
+update_costs_from_copies (ira_allocno_t allocno, bool decr_p, bool record_p)
 {
   int hard_regno;
 
   hard_regno = ALLOCNO_HARD_REGNO (allocno);
   ira_assert (hard_regno >= 0 && ALLOCNO_CLASS (allocno) != NO_REGS);
   start_update_cost ();
-  update_costs_from_allocno (allocno, hard_regno, 1, decr_p, true);
+  update_costs_from_allocno (allocno, hard_regno, 1, decr_p, record_p);
 }
 
 /* Restore costs of allocnos connected to ALLOCNO by copies as it was
@@ -1849,11 +1849,12 @@ assign_hard_reg (ira_allocno_t a, bool retry_p)
       for (i = hard_regno_nregs[best_hard_regno][mode] - 1; i >= 0; i--)
        allocated_hardreg_p[best_hard_regno + i] = true;
     }
-  restore_costs_from_copies (a);
+  if (! retry_p)
+    restore_costs_from_copies (a);
   ALLOCNO_HARD_REGNO (a) = best_hard_regno;
   ALLOCNO_ASSIGNED_P (a) = true;
   if (best_hard_regno >= 0)
-    update_costs_from_copies (a, true);
+    update_costs_from_copies (a, true, ! retry_p);
   ira_assert (ALLOCNO_CLASS (a) == aclass);
   /* We don't need updated costs anymore: */
   ira_free_allocno_updated_costs (a);
@@ -2942,7 +2943,7 @@ color_pass (ira_loop_tree_node_t loop_tree_node)
            ALLOCNO_HARD_REGNO (subloop_allocno) = hard_regno;
            ALLOCNO_ASSIGNED_P (subloop_allocno) = true;
            if (hard_regno >= 0)
-             update_costs_from_copies (subloop_allocno, true);
+             update_costs_from_copies (subloop_allocno, true, true);
            /* We don't need updated costs anymore: */
            ira_free_allocno_updated_costs (subloop_allocno);
          }
@@ -2986,7 +2987,7 @@ color_pass (ira_loop_tree_node_t loop_tree_node)
                  ALLOCNO_HARD_REGNO (subloop_allocno) = hard_regno;
                  ALLOCNO_ASSIGNED_P (subloop_allocno) = true;
                  if (hard_regno >= 0)
-                   update_costs_from_copies (subloop_allocno, true);
+                   update_costs_from_copies (subloop_allocno, true, true);
                  /* We don't need updated costs anymore: */
                  ira_free_allocno_updated_costs (subloop_allocno);
                }
@@ -3002,7 +3003,7 @@ color_pass (ira_loop_tree_node_t loop_tree_node)
                  ALLOCNO_HARD_REGNO (subloop_allocno) = hard_regno;
                  ALLOCNO_ASSIGNED_P (subloop_allocno) = true;
                  if (hard_regno >= 0)
-                   update_costs_from_copies (subloop_allocno, true);
+                   update_costs_from_copies (subloop_allocno, true, true);
                  /* We don't need updated costs anymore: */
                  ira_free_allocno_updated_costs (subloop_allocno);
                }
@@ -3983,7 +3984,7 @@ ira_mark_allocation_change (int regno)
               ? ALLOCNO_CLASS_COST (a)
               : ALLOCNO_HARD_REG_COSTS (a)
                 [ira_class_hard_reg_index[aclass][old_hard_regno]]);
-      update_costs_from_copies (a, false);
+      update_costs_from_copies (a, false, false);
     }
   ira_overall_cost -= cost;
   ALLOCNO_HARD_REGNO (a) = hard_regno;
@@ -3998,7 +3999,7 @@ ira_mark_allocation_change (int regno)
               ? ALLOCNO_CLASS_COST (a)
               : ALLOCNO_HARD_REG_COSTS (a)
                 [ira_class_hard_reg_index[aclass][hard_regno]]);
-      update_costs_from_copies (a, true);
+      update_costs_from_copies (a, true, false);
     }
   else
     /* Reload changed class of the allocno.  */