]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/65647 (GCC won't stop when compile for armv6-m)
authorVladimir Makarov <vmakarov@redhat.com>
Sat, 4 Apr 2015 14:35:59 +0000 (14:35 +0000)
committerVladimir Makarov <vmakarov@gcc.gnu.org>
Sat, 4 Apr 2015 14:35:59 +0000 (14:35 +0000)
2015-04-04  Vladimir Makarov  <vmakarov@redhat.com>

PR target/65647
* lra-int.h (LRA_MAX_REMATERIALIZATION_PASSES): New.  Add its
value checking.
(lra_rematerialization_iter): New.
* lra.c (lra): Initialize lra_rematerialization_iter.
Stop updating lra_constraint_new_regno_start after switching of
inheritance and rematerialization.
* lra-remat.c (lra_rematerialization_iter): New.
(lra_remat): Add printing pass iteration.  Do rematerialization
only first LRA_MAX_REMATERIALIZATION_PASSES iterations.

2015-04-04  Vladimir Makarov  <vmakarov@redhat.com>

PR target/65647
* gcc.target/arm/pr65647.c: New.

From-SVN: r221867

gcc/ChangeLog
gcc/lra-int.h
gcc/lra-remat.c
gcc/lra.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/arm/pr65647.c [new file with mode: 0644]

index d5d3aaa70a919f06c656f02d805c8be2ac193a31..e67aae8582ea2e8f09ec1421875190d160ca9095 100644 (file)
@@ -1,3 +1,16 @@
+2015-04-04  Vladimir Makarov  <vmakarov@redhat.com>
+
+       PR target/65647
+       * lra-int.h (LRA_MAX_REMATERIALIZATION_PASSES): New.  Add its
+       value checking.
+       (lra_rematerialization_iter): New.
+       * lra.c (lra): Initialize lra_rematerialization_iter.
+       Stop updating lra_constraint_new_regno_start after switching of
+       inheritance and rematerialization.
+       * lra-remat.c (lra_rematerialization_iter): New.
+       (lra_remat): Add printing pass iteration.  Do rematerialization
+       only first LRA_MAX_REMATERIALIZATION_PASSES iterations.
+
 2015-04-04  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/64909
index 735259123d666b021188c4f1a6171dd4fe3a6d8f..c6b147e6f781d190308cbdcee2302fefeece4e94 100644 (file)
@@ -271,6 +271,14 @@ typedef struct lra_insn_recog_data *lra_insn_recog_data_t;
 #error wrong LRA_MAX_INHERITANCE_PASSES value
 #endif
 
+/* Analogous macro to the above one but for rematerialization.  */
+#define LRA_MAX_REMATERIALIZATION_PASSES 2
+
+#if LRA_MAX_REMATERIALIZATION_PASSES <= 0 \
+    || LRA_MAX_REMATERIALIZATION_PASSES >= LRA_MAX_ASSIGNMENT_ITERATION_NUMBER - 8
+#error wrong LRA_MAX_REMATERIALIZATION_PASSES value
+#endif
+
 /* lra.c: */
 
 extern FILE *lra_dump_file;
@@ -392,6 +400,7 @@ extern void lra_final_code_change (void);
 
 /* lra-remat.c:  */
 
+extern int lra_rematerialization_iter;
 extern bool lra_remat (void);
 
 /* lra-elimination.c: */
index ac827795713db4e8440d02baca971dd2b0ec8055..36ea79282deb462892edbcf8f2e67f75ed8858d0 100644 (file)
@@ -1259,6 +1259,9 @@ do_remat (void)
 
 \f
 
+/* Current number of rematerialization iteration.  */
+int lra_rematerialization_iter;
+
 /* Entry point of the rematerialization sub-pass.  Return true if we
    did any rematerialization.  */
 bool
@@ -1270,6 +1273,13 @@ lra_remat (void)
 
   if (! flag_lra_remat)
     return false;
+  lra_rematerialization_iter++;
+  if (lra_rematerialization_iter > LRA_MAX_REMATERIALIZATION_PASSES)
+    return false;
+  if (lra_dump_file != NULL)
+    fprintf (lra_dump_file,
+            "\n******** Rematerialization #%d: ********\n\n",
+            lra_rematerialization_iter);
   timevar_push (TV_LRA_REMAT);
   insn_to_cand = XCNEWVEC (cand_t, get_max_uid ());
   regno_cands = XCNEWVEC (cand_t, max_regno);
index 269a0f14f74737aa14d4b6e5cf334de28c60261b..a29266e7ecc09c672013fb8a2a8114faf599b2a5 100644 (file)
--- a/gcc/lra.c
+++ b/gcc/lra.c
@@ -2260,6 +2260,7 @@ lra (FILE *f)
   lra_live_range_iter = lra_coalesce_iter = lra_constraint_iter = 0;
   lra_assignment_iter = lra_assignment_iter_after_spill = 0;
   lra_inheritance_iter = lra_undo_inheritance_iter = 0;
+  lra_rematerialization_iter = 0;
 
   setup_reg_spill_flag ();
 
@@ -2405,7 +2406,12 @@ lra (FILE *f)
       /* Assignment of stack slots changes elimination offsets for
         some eliminations.  So update the offsets here.  */
       lra_eliminate (false, false);
-      lra_constraint_new_regno_start = max_reg_num ();
+      /* After switching off inheritance and rematerialization passes,
+        don't forget reload pseudos after spilling sub-pass to avoid
+        LRA cycling in some complicated cases.  */
+      if (lra_inheritance_iter <= LRA_MAX_INHERITANCE_PASSES
+         || lra_rematerialization_iter <= LRA_MAX_REMATERIALIZATION_PASSES)
+       lra_constraint_new_regno_start = max_reg_num ();
       lra_assignment_iter_after_spill = 0;
     }
   restore_scratches ();
index 09d6bd943e56ba20f11863e50db88e3ec7851780..bb7d971c96eacaf2fb5f395d80090f4276746b4e 100644 (file)
@@ -1,3 +1,8 @@
+2015-04-04  Vladimir Makarov  <vmakarov@redhat.com>
+
+       PR target/65647
+       * gcc.target/arm/pr65647.c: New.
+
 2015-04-03  Jan Hubicka  <hubicka@ucw.cz>
 
        PR ipa/65655
diff --git a/gcc/testsuite/gcc.target/arm/pr65647.c b/gcc/testsuite/gcc.target/arm/pr65647.c
new file mode 100644 (file)
index 0000000..686eb58
--- /dev/null
@@ -0,0 +1,58 @@
+/* { dg-do compile } */
+/* { dg-options "-march=armv6-m -mthumb -O3 -w" } */
+
+a, b, c, e, g = &e, h, i = 7, l = 1, m, n, o, q = &m, r, s = &r, u, w = 9, x,
+  y = 6, z, t6 = 7, t8, t9 = 1, t11 = 5, t12 = &t8, t13 = 3, t15,
+  t16 = &t15;
+struct {
+  long long f3;
+    char f4
+} p = {3}
+
+    ,
+  t = {4};
+
+struct S1 {
+  long long f0;
+  short f1;
+    long long f2
+} d;
+long long f = 4073709551613, t7 = 8, t14 = 4073709551610;
+j[];
+k = j;
+v = &d;
+*t10 = j;
+struct S1 fn1();
+struct S1 fn2() {
+  signed char t1;
+  struct S1 t2;
+  long t3 = x;
+  short t4 = h;
+  short *t5 = &l;
+  fn1(t2, w, 1, o);
+  if (u) {
+    l = q;
+    t1 = a < b ?: b;
+    z = c >= 2 || t1 << c;
+  }
+  *t5 = t4 &= t3;
+  fn3(y);
+}
+
+fn4() {
+  t6 = t.f3;
+  fn5(k, t7);
+}
+
+struct S1 fn1() {
+  f = 0;
+  for (; i;)
+    ;
+  t11 = 0;
+  t13 = *t10 = t14 || n;
+  t9 = t12;
+  for (; p.f4;)
+    s = t16 <= fn6();
+  if (g)
+    v = 0;
+}