re PR rtl-optimization/80357 (ICE in model_update_limit_points_in_group, at haifa...
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 18 Apr 2017 18:49:19 +0000 (18:49 +0000)
committerJeff Law <law@gcc.gnu.org>
Tue, 18 Apr 2017 18:49:19 +0000 (12:49 -0600)
gcc/
PR rtl-optimization/80357
* haifa-sched.c (tmp_bitmap): New variable.
(model_recompute): Handle duplicate use records.
(alloc_global_sched_pressure_data): Initialize tmp_bitmap.
(free_global_sched_pressure_data): Free it.

gcc/testsuite/
PR rtl-optimization/80357
* gcc.c-torture/compile/pr80357.c: New test.

From-SVN: r246980

gcc/ChangeLog
gcc/haifa-sched.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr80357.c [new file with mode: 0644]

index 621ec58f1e12e6534716438b82c0a5842060e81e..0278e495ef58dac933a912c0041494f6061659e0 100644 (file)
@@ -1,3 +1,11 @@
+2017-04-18  Richard Sandiford  <richard.sandiford@arm.com>
+
+       PR rtl-optimization/80357
+       * haifa-sched.c (tmp_bitmap): New variable.
+       (model_recompute): Handle duplicate use records.
+       (alloc_global_sched_pressure_data): Initialize tmp_bitmap.
+       (free_global_sched_pressure_data): Free it.
+
 2017-04-18  Bernd Edlinger  <bernd.edlinger@hotmail.de>
 
        Revert:
index 07de1bbbb2391954928d017889ef0aa679aa8d62..0ebf110471c5d82beb7b48896960bcccefbc79f5 100644 (file)
@@ -930,6 +930,9 @@ static bitmap saved_reg_live;
 /* Registers mentioned in the current region.  */
 static bitmap region_ref_regs;
 
+/* Temporary bitmap used for SCHED_PRESSURE_MODEL.  */
+static bitmap tmp_bitmap;
+
 /* Effective number of available registers of a given class (see comment
    in sched_pressure_start_bb).  */
 static int sched_class_regs_num[N_REG_CLASSES];
@@ -2135,10 +2138,11 @@ model_recompute (rtx_insn *insn)
      registers that will be born in the range [model_curr_point, POINT).  */
   num_uses = 0;
   num_pending_births = 0;
+  bitmap_clear (tmp_bitmap);
   for (use = INSN_REG_USE_LIST (insn); use != NULL; use = use->next_insn_use)
     {
       new_last = model_last_use_except (use);
-      if (new_last < point)
+      if (new_last < point && bitmap_set_bit (tmp_bitmap, use->regno))
        {
          gcc_assert (num_uses < ARRAY_SIZE (uses));
          uses[num_uses].last_use = new_last;
@@ -7241,6 +7245,8 @@ alloc_global_sched_pressure_data (void)
          saved_reg_live = BITMAP_ALLOC (NULL);
          region_ref_regs = BITMAP_ALLOC (NULL);
        }
+      if (sched_pressure == SCHED_PRESSURE_MODEL)
+       tmp_bitmap = BITMAP_ALLOC (NULL);
 
       /* Calculate number of CALL_SAVED_REGS and FIXED_REGS in register classes
         that we calculate register pressure for.  */
@@ -7274,6 +7280,8 @@ free_global_sched_pressure_data (void)
          BITMAP_FREE (region_ref_regs);
          BITMAP_FREE (saved_reg_live);
        }
+      if (sched_pressure == SCHED_PRESSURE_MODEL)
+       BITMAP_FREE (tmp_bitmap);
       BITMAP_FREE (curr_reg_live);
       free (sched_regno_pressure_class);
     }
index cf5d0be6da340b87a9625fe4dd70fc2967a25c12..05c5e23f07e34fcaa965ea3dff816afcaa767531 100644 (file)
@@ -1,3 +1,8 @@
+2017-04-18  Richard Sandiford  <richard.sandiford@arm.com>
+
+       PR rtl-optimization/80357
+       * gcc.c-torture/compile/pr80357.c: New test.
+
 2017-04-18  Jeff Law  <law@redhat.com>
 
        PR middle-end/80422
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr80357.c b/gcc/testsuite/gcc.c-torture/compile/pr80357.c
new file mode 100644 (file)
index 0000000..a3c6ab0
--- /dev/null
@@ -0,0 +1,18 @@
+typedef char a;
+a b, c;
+int d, e;
+void f(void *g) { *(volatile int *)g; }
+void j() {
+  a h, i;
+  for (; b; b += 2) {
+    d = b;
+    i = i >> b;
+    if (i)
+      continue;
+    f(&c + (b >> 2));
+    h = 0;
+    for (; h < 8 / 2; h++)
+      if (i << h)
+        e = 0;
+  }
+}