aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/sched-deps.c22
-rw-r--r--gcc/sched-rgn.c5
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr46614.c56
5 files changed, 93 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f9b2d82..d6cd569 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,14 @@
+2010-11-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/46614
+ * sched-deps.c (NON_FLUSH_JUMP_KIND, NON_FLUSH_JUMP_P): Define.
+ (deps_analyze_insn): Mark JUMP_INSNs in
+ last_pending_memory_flush that weren't added through
+ flush_pending_lists with NON_FLUSH_JUMP_KIND.
+ (sched_analyze_2, sched_analyze_insn): Check NON_FLUSH_JUMP_P
+ on INSN_LIST instead of JUMP_P check on its operand.
+ * sched-rgn.c (concat_INSN_LIST): Copy over REG_NOTE_KIND.
+
2010-11-24 Richard Guenther <rguenther@suse.de>
* lto-streamer-in.c (input_gimple_stmt): Use types_compatible_p.
diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
index d2e3bb8..d1610af 100644
--- a/gcc/sched-deps.c
+++ b/gcc/sched-deps.c
@@ -53,6 +53,12 @@ along with GCC; see the file COPYING3. If not see
#define CHECK (false)
#endif
+/* In deps->last_pending_memory_flush marks JUMP_INSNs that weren't
+ added to the list because of flush_pending_lists, stands just
+ for itself and not for any other pending memory reads/writes. */
+#define NON_FLUSH_JUMP_KIND REG_DEP_ANTI
+#define NON_FLUSH_JUMP_P(x) (REG_NOTE_KIND (x) == NON_FLUSH_JUMP_KIND)
+
/* Holds current parameters for the dependency analyzer. */
struct sched_deps_info_def *sched_deps_info;
@@ -2484,7 +2490,7 @@ sched_analyze_2 (struct deps_desc *deps, rtx x, rtx insn)
for (u = deps->last_pending_memory_flush; u; u = XEXP (u, 1))
{
- if (! JUMP_P (XEXP (u, 0)))
+ if (! NON_FLUSH_JUMP_P (u))
add_dependence (insn, XEXP (u, 0), REG_DEP_ANTI);
else if (deps_may_trap_p (x))
{
@@ -2796,8 +2802,7 @@ sched_analyze_insn (struct deps_desc *deps, rtx x, rtx insn)
REG_DEP_ANTI);
for (u = deps->last_pending_memory_flush; u; u = XEXP (u, 1))
- if (! JUMP_P (XEXP (u, 0))
- || !sel_sched_p ())
+ if (! NON_FLUSH_JUMP_P (u) || !sel_sched_p ())
add_dependence (insn, XEXP (u, 0), REG_DEP_ANTI);
EXECUTE_IF_SET_IN_REG_SET (reg_pending_uses, 0, i, rsi)
@@ -3242,8 +3247,15 @@ deps_analyze_insn (struct deps_desc *deps, rtx insn)
if (deps->pending_flush_length++ > MAX_PENDING_LIST_LENGTH)
flush_pending_lists (deps, insn, true, true);
else
- deps->last_pending_memory_flush
- = alloc_INSN_LIST (insn, deps->last_pending_memory_flush);
+ {
+ deps->last_pending_memory_flush
+ = alloc_INSN_LIST (insn, deps->last_pending_memory_flush);
+ /* Signal to sched_analyze_insn that this jump stands
+ just for its own, not any other pending memory
+ reads/writes flush_pending_lists had to flush. */
+ PUT_REG_NOTE_KIND (deps->last_pending_memory_flush,
+ NON_FLUSH_JUMP_KIND);
+ }
}
sched_analyze_insn (deps, PATTERN (insn), insn);
diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c
index 7e971e1..1297cf8 100644
--- a/gcc/sched-rgn.c
+++ b/gcc/sched-rgn.c
@@ -2574,7 +2574,10 @@ concat_INSN_LIST (rtx copy, rtx old)
{
rtx new_rtx = old;
for (; copy ; copy = XEXP (copy, 1))
- new_rtx = alloc_INSN_LIST (XEXP (copy, 0), new_rtx);
+ {
+ new_rtx = alloc_INSN_LIST (XEXP (copy, 0), new_rtx);
+ PUT_REG_NOTE_KIND (new_rtx, REG_NOTE_KIND (copy));
+ }
return new_rtx;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b4fe8ba..feae590 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2010-11-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/46614
+ * gcc.dg/pr46614.c: New test.
+
2010-11-24 Tobias Burnus <burnus@net-b.de>
PR fortran/46638
diff --git a/gcc/testsuite/gcc.dg/pr46614.c b/gcc/testsuite/gcc.dg/pr46614.c
new file mode 100644
index 0000000..8e75780
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr46614.c
@@ -0,0 +1,56 @@
+/* PR rtl-optimization/46614 */
+/* { dg-do run } */
+/* { dg-options "-O -fno-rename-registers -fsched2-use-superblocks -fschedule-insns2 -funroll-loops" } */
+
+extern void abort (void);
+
+struct S
+{
+ unsigned char a;
+ unsigned char b;
+ unsigned int c;
+ unsigned int e;
+ unsigned char f;
+ unsigned int g;
+};
+
+void bar (struct S *x)
+{
+ int i;
+ struct S *p = x;
+ struct S r[16];
+ unsigned j;
+ for (i = 0; i < 16; i++)
+ {
+ r[i].c = p->b + p->c;
+ j = p->c + p->f;
+ r[i].a = j + p->b;
+ r[i].f = p->f + p->e;
+ r[i].g = p->b + p->c;
+ }
+ for (i = 0; i < 16; i++)
+ {
+ if (r[i].c != x[i].b + x[i].c
+ || r[i].a != x[i].c + x[i].f + x[i].b
+ || r[i].f != x[i].f + x[i].e
+ || r[i].g != x[i].b + x[i].c)
+ abort ();
+ }
+ for (i = 0; i < 16; i++)
+ {
+ r[i].b = p->c;
+ if (r[i].b != x[i].c)
+ abort ();
+ }
+}
+
+int
+main ()
+{
+ int i;
+ struct S x[16];
+ for (i = 0; i < 16; i++)
+ x[i].b = x[i].c = x[i].e = x[i].f = 5;
+ bar (x);
+ return 0;
+}