public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrey Belevantsev <abel@ispras.ru>
To: Alexander Monakov <amonakov@ispras.ru>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Fix PR 85423 (Re: Fix PRs 80463, 83972, 83480)
Date: Mon, 23 Apr 2018 14:22:00 -0000	[thread overview]
Message-ID: <79a550e3-d3ab-6319-6ae5-0ef20a0286b8@ispras.ru> (raw)
In-Reply-To: <07578825-47c1-45e7-8750-327997b8ff69@ispras.ru>

[-- Attachment #1: Type: text/plain, Size: 781 bytes --]

Hello,

So this PR shows that I have incorrectly mirrored the conditional from
sched-deps.c that creates the dependence from a debug insn on the previous
insn (see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80463#c3 for the
hunk).  Thus we have incorrectly discarded some legitimate debug-debug
dependencies.  The straightforward fix works for all of four PRs, tested on
x86-64.

I have put the test in gcc.dg though it requires -march=nano.  Do you want
me to create an extra machine-dependent test?

Best,
Andrey

2018-04-23  Andrey Belevantsev  <abel@ispras.ru>

        PR rtl-optimization/85423

        * sel-sched-ir.c (has_dependence_note_mem_dep): Only discard
        dependencies to debug insns when previous insn is non-debug.

        * gcc.dg/pr85423.c: New test.


[-- Attachment #2: pr85423.diff --]
[-- Type: text/plain, Size: 1281 bytes --]

diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index ee970522890..85ff5bd3eb4 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -3308,7 +3308,7 @@ has_dependence_note_dep (insn_t pro, ds_t ds ATTRIBUTE_UNUSED)
      that a bookkeeping copy should be movable as the original insn.
      Detect that here and allow that movement if we allowed it before
      in the first place.  */
-  if (DEBUG_INSN_P (real_con)
+  if (DEBUG_INSN_P (real_con) && !DEBUG_INSN_P (real_pro)
       && INSN_UID (NEXT_INSN (pro)) == INSN_UID (real_con))
     return;
 
diff --git a/gcc/testsuite/gcc.dg/pr85423.c b/gcc/testsuite/gcc.dg/pr85423.c
new file mode 100644
index 00000000000..21d4a2eb4b9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr85423.c
@@ -0,0 +1,26 @@
+/* { dg-do compile { target powerpc*-*-* ia64-*-* i?86-*-* x86_64-*-* } } */
+/* { dg-options "-O2 -fselective-scheduling2 -fvar-tracking-assignments -fno-guess-branch-probability -fno-peephole2 -fno-ssa-phiopt -fno-tree-pre --param max-jump-thread-duplication-stmts=8 -w" } */
+
+int vn, xm;
+
+void
+i1 (int);
+
+void
+mb (int *ap, int ev)
+{
+  while (vn < 1)
+    {
+      i1 (vn);
+
+      ev += *ap && ++vn;
+
+      while (xm < 1)
+        ++xm;
+
+      if (*ap == 0)
+        *ap = ev;
+
+      ++vn;
+    }
+}

  parent reply	other threads:[~2018-04-23 14:03 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-03 15:33 Selective scheduling fixes Andrey Belevantsev
2018-04-03 15:42 ` Fix PR 83530 Andrey Belevantsev
2018-04-06 15:56   ` Alexander Monakov
2018-04-09  9:10     ` Andrey Belevantsev
2018-04-03 15:48 ` Fix PR 83962 Andrey Belevantsev
2018-04-06 15:59   ` Alexander Monakov
2018-04-09  9:17     ` Andrey Belevantsev
2018-04-13 10:26       ` Add test from PR 83852 (was Re: Fix PR 83962) Andrey Belevantsev
2018-04-03 15:53 ` Fix PR 83913 Andrey Belevantsev
2018-04-03 16:03   ` Alexander Monakov
2018-04-03 16:08     ` Andrey Belevantsev
2018-04-06 16:10   ` Alexander Monakov
2018-04-09  9:47     ` Andrey Belevantsev
2018-04-03 16:06 ` Fix PRs 80463, 83972, 83480 Andrey Belevantsev
2018-04-06 16:19   ` Alexander Monakov
2018-04-09 10:30     ` Andrey Belevantsev
2018-04-09 18:24       ` Jakub Jelinek
2018-04-10  6:32         ` Andrey Belevantsev
2018-04-23 14:22       ` Andrey Belevantsev [this message]
2018-04-23 16:35         ` Fix PR 85423 (Re: Fix PRs 80463, 83972, 83480) Alexander Monakov
2018-04-23 16:36         ` Jakub Jelinek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=79a550e3-d3ab-6319-6ae5-0ef20a0286b8@ispras.ru \
    --to=abel@ispras.ru \
    --cc=amonakov@ispras.ru \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).