summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorvmakarov <vmakarov@138bc75d-0d04-0410-961f-82ee72b054a4>2015-04-04 14:35:59 +0000
committervmakarov <vmakarov@138bc75d-0d04-0410-961f-82ee72b054a4>2015-04-04 14:35:59 +0000
commitfa4f0b4ea29543315d5d6e4dee0a9c7806f3e144 (patch)
treecc574b4eb2853d00fe21a06d5c86561ed8401c46 /gcc
parent7a66d0cf98230d1b48a07c55d297b3507567d357 (diff)
downloadgcc-fa4f0b4ea29543315d5d6e4dee0a9c7806f3e144.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@221867 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog13
-rw-r--r--gcc/lra-int.h9
-rw-r--r--gcc/lra-remat.c10
-rw-r--r--gcc/lra.c8
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/arm/pr65647.c58
6 files changed, 102 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d5d3aaa70a9..e67aae8582e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/lra-int.h b/gcc/lra-int.h
index 735259123d6..c6b147e6f78 100644
--- a/gcc/lra-int.h
+++ b/gcc/lra-int.h
@@ -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: */
diff --git a/gcc/lra-remat.c b/gcc/lra-remat.c
index ac827795713..36ea79282de 100644
--- a/gcc/lra-remat.c
+++ b/gcc/lra-remat.c
@@ -1259,6 +1259,9 @@ do_remat (void)
+/* 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);
diff --git a/gcc/lra.c b/gcc/lra.c
index 269a0f14f74..a29266e7ecc 100644
--- 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 ();
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 09d6bd943e5..bb7d971c96e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 00000000000..686eb587ae3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/pr65647.c
@@ -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;
+}