public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/108519] New: [13 regression] gcc.target/powerpc/pr105586.c  fails after r13-5154-g733a1b777f16cd
@ 2023-01-24 15:16 seurer at gcc dot gnu.org
  2023-01-24 15:18 ` [Bug rtl-optimization/108519] " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: seurer at gcc dot gnu.org @ 2023-01-24 15:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108519

            Bug ID: 108519
           Summary: [13 regression] gcc.target/powerpc/pr105586.c  fails
                    after r13-5154-g733a1b777f16cd
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: seurer at gcc dot gnu.org
  Target Milestone: ---

g:733a1b777f16cd397b43a242d9c31761f66d3da8, r13-5154-g733a1b777f16cd

This test is failing on some powerpc64 LE systems.

make  -k check-gcc RUNTESTFLAGS="powerpc.exp=gcc.target/powerpc/pr105586.c"
FAIL: gcc.target/powerpc/pr105586.c (test for excess errors)
# of unexpected failures        1



/home/seurer/gcc/git/build/gcc-test/gcc/xgcc
-B/home/seurer/gcc/git/build/gcc-test/gcc/
/home/seurer/gcc/git/gcc-test/gcc/testsuite/gcc.target/powerpc/pr105586.c
-fdiagnostics-plain-output -mdejagnu-tune=power4 -O2 -fcompare-debug
-fno-if-conversion -fno-guess-branch-probability -S -o pr105586.s^M
xgcc: error:
/home/seurer/gcc/git/gcc-test/gcc/testsuite/gcc.target/powerpc/pr105586.c:
'-fcompare-debug' failure (length)^M
compiler exited with status 1
FAIL: gcc.target/powerpc/pr105586.c (test for excess errors)
Excess errors:
xgcc: error:
/home/seurer/gcc/git/gcc-test/gcc/testsuite/gcc.target/powerpc/pr105586.c:
'-fcompare-debug' failure (length)


commit 733a1b777f16cd397b43a242d9c31761f66d3da8 (HEAD, refs/bisect/bad)
Author: Alexander Monakov <amonakov@ispras.ru>
Date:   Fri Jan 13 21:04:02 2023 +0300

    sched-deps: do not schedule pseudos across calls [PR108117]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug rtl-optimization/108519] [13 regression] gcc.target/powerpc/pr105586.c  fails after r13-5154-g733a1b777f16cd
  2023-01-24 15:16 [Bug other/108519] New: [13 regression] gcc.target/powerpc/pr105586.c fails after r13-5154-g733a1b777f16cd seurer at gcc dot gnu.org
@ 2023-01-24 15:18 ` rguenth at gcc dot gnu.org
  2023-01-25 16:12 ` amonakov at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-01-24 15:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108519

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |compare-debug-failure,
                   |                            |testsuite-fail
          Component|other                       |rtl-optimization
   Target Milestone|---                         |13.0
           Priority|P3                          |P1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug rtl-optimization/108519] [13 regression] gcc.target/powerpc/pr105586.c  fails after r13-5154-g733a1b777f16cd
  2023-01-24 15:16 [Bug other/108519] New: [13 regression] gcc.target/powerpc/pr105586.c fails after r13-5154-g733a1b777f16cd seurer at gcc dot gnu.org
  2023-01-24 15:18 ` [Bug rtl-optimization/108519] " rguenth at gcc dot gnu.org
@ 2023-01-25 16:12 ` amonakov at gcc dot gnu.org
  2023-01-26 19:21 ` seurer at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: amonakov at gcc dot gnu.org @ 2023-01-25 16:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108519

--- Comment #1 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
We diverge in sched1 due to extra calls to advance_one_cycle when scheduling a
BB that is empty apart from one debug insn. The following patch adds a hexdump
of automaton state to make the problem evident:

diff --git a/gcc/sched-rgn.cc b/gcc/sched-rgn.cc
index 420c45dff..c09398897 100644
--- a/gcc/sched-rgn.cc
+++ b/gcc/sched-rgn.cc
@@ -3098,8 +3098,14 @@ save_state_for_fallthru_edge (basic_block last_bb,
state_t state)
     memcpy (bb_state[f->dest->index], state,
            dfa_state_size);
     if (sched_verbose >= 5)
-      fprintf (sched_dump, "saving state for edge %d->%d\n",
-              f->src->index, f->dest->index);
+      {
+       fprintf (sched_dump, "saving state for edge %d->%d\n",
+                f->src->index, f->dest->index);
+       for (size_t i = 0; i < dfa_state_size; i++)
+         fprintf (sched_dump, "%02x%c", i[(unsigned char *)state],
+                  (i+1) % 16 ? ' ' : '\n');
+       fprintf(sched_dump, "\n---\n");
+      }
   }
 }

With the above patch it's obvious we advance the automaton state a few extra
times when scheduling BB 3, and then inherit the modified state to BB 4.

I think we don't need to schedule blocks that only contain debug insns. IBM
folks, care to test the following?

diff --git a/gcc/haifa-sched.cc b/gcc/haifa-sched.cc
index 4efaa9445..f00a92e26 100644
--- a/gcc/haifa-sched.cc
+++ b/gcc/haifa-sched.cc
@@ -5040,7 +5040,7 @@ no_real_insns_p (const rtx_insn *head, const rtx_insn
*tail)
 {
   while (head != NEXT_INSN (tail))
     {
-      if (!NOTE_P (head) && !LABEL_P (head))
+      if (!NOTE_P (head) && !LABEL_P (head) && !DEBUG_INSN_P (head))
        return 0;
       head = NEXT_INSN (head);
     }
diff --git a/gcc/sched-rgn.cc b/gcc/sched-rgn.cc
index 420c45dff..c09398897 100644
--- a/gcc/sched-rgn.cc
+++ b/gcc/sched-rgn.cc
@@ -2753,7 +2753,7 @@ free_block_dependencies (int bb)

   get_ebb_head_tail (EBB_FIRST_BB (bb), EBB_LAST_BB (bb), &head, &tail);

-  if (no_real_insns_p (head, tail))
+  if (0 && no_real_insns_p (head, tail))
     return;

   sched_free_deps (head, tail, true);

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug rtl-optimization/108519] [13 regression] gcc.target/powerpc/pr105586.c  fails after r13-5154-g733a1b777f16cd
  2023-01-24 15:16 [Bug other/108519] New: [13 regression] gcc.target/powerpc/pr105586.c fails after r13-5154-g733a1b777f16cd seurer at gcc dot gnu.org
  2023-01-24 15:18 ` [Bug rtl-optimization/108519] " rguenth at gcc dot gnu.org
  2023-01-25 16:12 ` amonakov at gcc dot gnu.org
@ 2023-01-26 19:21 ` seurer at gcc dot gnu.org
  2023-01-26 20:28 ` amonakov at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: seurer at gcc dot gnu.org @ 2023-01-26 19:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108519

--- Comment #2 from seurer at gcc dot gnu.org ---
I tried to test that patch but it didn't apply cleanly.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug rtl-optimization/108519] [13 regression] gcc.target/powerpc/pr105586.c  fails after r13-5154-g733a1b777f16cd
  2023-01-24 15:16 [Bug other/108519] New: [13 regression] gcc.target/powerpc/pr105586.c fails after r13-5154-g733a1b777f16cd seurer at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-01-26 19:21 ` seurer at gcc dot gnu.org
@ 2023-01-26 20:28 ` amonakov at gcc dot gnu.org
  2023-02-23  9:12 ` linkw at gcc dot gnu.org
  2023-02-23  9:46 ` linkw at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: amonakov at gcc dot gnu.org @ 2023-01-26 20:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108519

--- Comment #3 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
Ah, a worthy sequel to "Note that I wasn't able to figure out a usable email
address for the submitter" from PR 107353. Nevermind then.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug rtl-optimization/108519] [13 regression] gcc.target/powerpc/pr105586.c  fails after r13-5154-g733a1b777f16cd
  2023-01-24 15:16 [Bug other/108519] New: [13 regression] gcc.target/powerpc/pr105586.c fails after r13-5154-g733a1b777f16cd seurer at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-01-26 20:28 ` amonakov at gcc dot gnu.org
@ 2023-02-23  9:12 ` linkw at gcc dot gnu.org
  2023-02-23  9:46 ` linkw at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: linkw at gcc dot gnu.org @ 2023-02-23  9:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108519

Kewen Lin <linkw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |linkw at gcc dot gnu.org
         Resolution|---                         |DUPLICATE

--- Comment #4 from Kewen Lin <linkw at gcc dot gnu.org> ---
This one is dup of PR108273, the culprit commit just exposes this latent issue
on Power8 LE (and also cover the failure on Power10 LE).

*** This bug has been marked as a duplicate of bug 108273 ***

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug rtl-optimization/108519] [13 regression] gcc.target/powerpc/pr105586.c  fails after r13-5154-g733a1b777f16cd
  2023-01-24 15:16 [Bug other/108519] New: [13 regression] gcc.target/powerpc/pr105586.c fails after r13-5154-g733a1b777f16cd seurer at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-02-23  9:12 ` linkw at gcc dot gnu.org
@ 2023-02-23  9:46 ` linkw at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: linkw at gcc dot gnu.org @ 2023-02-23  9:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108519

--- Comment #5 from Kewen Lin <linkw at gcc dot gnu.org> ---
(In reply to Alexander Monakov from comment #1)
> We diverge in sched1 due to extra calls to advance_one_cycle when scheduling
> a BB that is empty apart from one debug insn. The following patch adds a
> hexdump of automaton state to make the problem evident:
> 
> diff --git a/gcc/sched-rgn.cc b/gcc/sched-rgn.cc
> index 420c45dff..c09398897 100644
> --- a/gcc/sched-rgn.cc
> +++ b/gcc/sched-rgn.cc
> @@ -3098,8 +3098,14 @@ save_state_for_fallthru_edge (basic_block last_bb,
> state_t state)
>      memcpy (bb_state[f->dest->index], state,
>             dfa_state_size);
>      if (sched_verbose >= 5)
> -      fprintf (sched_dump, "saving state for edge %d->%d\n",
> -              f->src->index, f->dest->index);
> +      {
> +       fprintf (sched_dump, "saving state for edge %d->%d\n",
> +                f->src->index, f->dest->index);
> +       for (size_t i = 0; i < dfa_state_size; i++)
> +         fprintf (sched_dump, "%02x%c", i[(unsigned char *)state],
> +                  (i+1) % 16 ? ' ' : '\n');
> +       fprintf(sched_dump, "\n---\n");
> +      }
>    }
>  }
> 
> With the above patch it's obvious we advance the automaton state a few extra
> times when scheduling BB 3, and then inherit the modified state to BB 4.

Nice tips for dumping!

> 
> I think we don't need to schedule blocks that only contain debug insns. IBM
> folks, care to test the following?

Yes, I agree. I attached one patch in PR108273 which also proposed to consider
DEBUG_INSN_P in no_real_insns_p, it's bootstrapped and regress-tested on
powerpc64 and powerpc64le, I'm going to test it on x86 and aarch64 if it's on
the right track. As to your proposed change in free_block_dependencies, I also
tried that before (it can make this test case compilation happy, yes :)), but
unfortunately it gets abort at

 383│ free_deps_list (deps_list_t l)
 384│ {
 385├─> gcc_assert (deps_list_empty_p (l));

for some cases in building libgcc, the root cause is that some block can have
more than one debug insn, there are some deps between them, I think the current
free_block_dependencies has the assumption that the deps which need to be
resolved would be handled during scheduling insn, so it calls sched_free_deps
with resolved_p "true", then it still leaves the deps like INSN_FORW_DEPS
uncleared, which is unexpected and caused the ICE.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-02-23  9:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-24 15:16 [Bug other/108519] New: [13 regression] gcc.target/powerpc/pr105586.c fails after r13-5154-g733a1b777f16cd seurer at gcc dot gnu.org
2023-01-24 15:18 ` [Bug rtl-optimization/108519] " rguenth at gcc dot gnu.org
2023-01-25 16:12 ` amonakov at gcc dot gnu.org
2023-01-26 19:21 ` seurer at gcc dot gnu.org
2023-01-26 20:28 ` amonakov at gcc dot gnu.org
2023-02-23  9:12 ` linkw at gcc dot gnu.org
2023-02-23  9:46 ` linkw at gcc dot gnu.org

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).