public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/42246]  New: ICE in init_seqno for 186.crafty with sel-sched
@ 2009-12-01 23:40 janis at gcc dot gnu dot org
  2009-12-04 18:01 ` [Bug rtl-optimization/42246] " amonakov at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: janis at gcc dot gnu dot org @ 2009-12-01 23:40 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2262 bytes --]

GCC trunk gets an internal compiler error when building SPEC CPU2000 test
186.crafty with "-O2 -fselective-scheduling -fsel-sched-pipelining
-fsel-sched-pipelining-outer-loops" on powerpc-linux, as demonstrated by this
minimized testcase:

-----------------------------------------------------------------
typedef enum
{
  empty = 0, pawn = 1, knight = 2, king = 3, bishop = 5, rook = 6, queen = 7
}
PIECE;
extern int p_values[15];
extern int *last[65];
int
Quiesce (int alpha, int beta, int wtm, int ply)
{
  register int initial_alpha, value, delta;
  register int *goodmv, *movep, moves = 0, *sortv, temp;
  for (movep = last[ply - 1]; movep < last[ply]; movep++)
    if (p_values[(((*movep) >> 15) & 7) + 7] +
        p_values[(((*movep) >> 18) & 7) + 7] >= delta)
      {
        register int done;
        register int *end = last[ply - 1] + moves - 1;
        do
          {
            done = 1;
            movep = last[ply - 1];
            for (; movep < end; movep++, sortv++)
              if (*sortv < *(sortv + 1))
                {
                  *(movep + 1) = temp;
                  done = 0;
                }
          }
        while (!done);
      }
}
-----------------------------------------------------------------

elm3b149% /home/janis/tools/gcc-trunk-anonsvn/bin/gcc -O2
-fselective-scheduling -fsel-sched-pipelining
-fsel-sched-pipelining-outer-loops -c bug.c
bug.c: In function ‘Quiesce’:
bug.c:32:1: internal compiler error: in init_seqno, at sel-sched.c:6722
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

The failure started with this large patch:

    http://gcc.gnu.org/viewcvs?view=rev&rev=145494

    r145494 | rguenth | 2009-04-03 10:24:28 +0000 (Fri, 03 Apr 2009)


-- 
           Summary: ICE in init_seqno for 186.crafty with sel-sched
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: janis at gcc dot gnu dot org
GCC target triplet: powerpc-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42246


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

* [Bug rtl-optimization/42246] ICE in init_seqno for 186.crafty with sel-sched
  2009-12-01 23:40 [Bug tree-optimization/42246] New: ICE in init_seqno for 186.crafty with sel-sched janis at gcc dot gnu dot org
@ 2009-12-04 18:01 ` amonakov at gcc dot gnu dot org
  2009-12-24  8:32 ` abel at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: amonakov at gcc dot gnu dot org @ 2009-12-04 18:01 UTC (permalink / raw)
  To: gcc-bugs



-- 

amonakov at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amonakov at gcc dot gnu dot
                   |                            |org
         AssignedTo|unassigned at gcc dot gnu   |amonakov at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-12-04 18:01:40
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42246


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

* [Bug rtl-optimization/42246] ICE in init_seqno for 186.crafty with sel-sched
  2009-12-01 23:40 [Bug tree-optimization/42246] New: ICE in init_seqno for 186.crafty with sel-sched janis at gcc dot gnu dot org
  2009-12-04 18:01 ` [Bug rtl-optimization/42246] " amonakov at gcc dot gnu dot org
@ 2009-12-24  8:32 ` abel at gcc dot gnu dot org
  2010-01-06 18:48 ` janis at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: abel at gcc dot gnu dot org @ 2009-12-24  8:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from abel at gcc dot gnu dot org  2009-12-24 08:32 -------
Here, we broke pipelining of outer loops when optimizing the scheduler core. 
The problems analyzed by Alexander are simple though.  First, when testing
whether a loop is considered for pipelining, I decided to play safe and also
check pipelining_p in addition to the flag in the aux loop data that was
designed specially for this.  Naturally, when we then disabled pipelining_p for
rescheduling pipelined loops, this broke, so to fix it we just need to stop
checking for pipelining_p.  The second problem is that we use the
last_added_blocks vector when adding blocks to the region, and we failed to
initialize it correctly for the case of moving preheader blocks from an inner
loop to an outer loop when we have added the vector.  Also easily fixed via
correctly initializing the vector.

Again, we would ask someone with access to ppc/ppc64 to test this patch as a
part of the combined patch with fixes for all sel-sched bugs, when our testing
will be completed.

This patch also fixes PR39453.



        * sel-sched-ir.c (considered_for_pipelining_p): Do not test
        for pipelining_p.
        (sel_add_loop_preheaders): Add preheader to last_added_blocks.
---
 gcc/sel-sched-ir.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index 2469822..3c2989a 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -5825,7 +5825,7 @@ considered_for_pipelining_p (struct loop *loop)
      latch.  We can't use header here, because this header could be
      just removed preheader and it will give us the wrong region number.
      Latch can't be used because it could be in the inner loop too.  */
-  if (LOOP_MARKED_FOR_PIPELINING_P (loop) && pipelining_p)
+  if (LOOP_MARKED_FOR_PIPELINING_P (loop))
     {
       int rgn = CONTAINING_RGN (loop->latch->index);

@@ -5974,7 +5974,10 @@ sel_add_loop_preheaders (void)
   for (i = 0;
        VEC_iterate (basic_block, preheader_blocks, i, bb);
        i++)
+    {
+      VEC_safe_push (basic_block, heap, last_added_blocks, bb);
       sel_add_bb (bb);
+    }

   VEC_free (basic_block, heap, preheader_blocks);
 }


-- 

abel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |abel at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42246


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

* [Bug rtl-optimization/42246] ICE in init_seqno for 186.crafty with sel-sched
  2009-12-01 23:40 [Bug tree-optimization/42246] New: ICE in init_seqno for 186.crafty with sel-sched janis at gcc dot gnu dot org
  2009-12-04 18:01 ` [Bug rtl-optimization/42246] " amonakov at gcc dot gnu dot org
  2009-12-24  8:32 ` abel at gcc dot gnu dot org
@ 2010-01-06 18:48 ` janis at gcc dot gnu dot org
  2010-01-06 18:52 ` janis at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: janis at gcc dot gnu dot org @ 2010-01-06 18:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from janis at gcc dot gnu dot org  2010-01-06 18:48 -------
The patch at http://gcc.gnu.org/ml/gcc-patches/2009-12/msg01209.html fixes the
testcase in the submitter's description, but there is code in CPU2000 test
200.sixtrack that triggers the same ICE with the same set of options, as shown
by this minimized testcase:

      subroutine distance(x,clo)
      implicit real*8 (a-h,o-z)
      dimension x(2,6),x1(2,6),clo(6)
      do 60 i=1,2
        do 20 j=1,6
          x(i,j)=clo(j)
   20   continue
        do 40 iq=1,6
          x1(i,iq)=0.0d0
   40   continue
        do 50 j=1,6
          x(i,j)=x1(i,j)
   50   continue
   60 continue
      return
      end

This testcase gets the ICE with and without the patch cited above.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42246


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

* [Bug rtl-optimization/42246] ICE in init_seqno for 186.crafty with sel-sched
  2009-12-01 23:40 [Bug tree-optimization/42246] New: ICE in init_seqno for 186.crafty with sel-sched janis at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2010-01-06 18:48 ` janis at gcc dot gnu dot org
@ 2010-01-06 18:52 ` janis at gcc dot gnu dot org
  2010-01-11 14:35 ` abel at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: janis at gcc dot gnu dot org @ 2010-01-06 18:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from janis at gcc dot gnu dot org  2010-01-06 18:52 -------
I should have mentioned in comment #2 that the ICE for sixtrack only happens
with -m32, not -m64.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42246


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

* [Bug rtl-optimization/42246] ICE in init_seqno for 186.crafty with sel-sched
  2009-12-01 23:40 [Bug tree-optimization/42246] New: ICE in init_seqno for 186.crafty with sel-sched janis at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2010-01-06 18:52 ` janis at gcc dot gnu dot org
@ 2010-01-11 14:35 ` abel at gcc dot gnu dot org
  2010-01-14 10:41 ` amonakov at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: abel at gcc dot gnu dot org @ 2010-01-11 14:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from abel at gcc dot gnu dot org  2010-01-11 14:35 -------
(In reply to comment #2)

This is the other bug in our region walk iterator that happens when pipelining
outer loops.  When looking for loop exits from an inner loop that is contained
in the outer loop currently being pipelined, we need to work harder to skip
several consecutive inner loops if needed.  The iterator assumes that all
preheaders of inner loops are available, so when skipping an inner loop, it
expects to find a block of an outer loop (which is possibly the preheader of
the next inner loop).  When we are removing empty blocks in the region body,
this is not the case, and we are immediately hitting the header of the next
inner loop.  Fortunately, the bug is rather easily fixed by using the already
implemented infrastructure as below.

        * sel-sched-ir.h (get_all_loop_exits): Include exits from inner
        loops.

diff --git a/gcc/sel-sched-ir.h b/gcc/sel-sched-ir.h
index 06082ac..317258c 100644
--- a/gcc/sel-sched-ir.h
+++ b/gcc/sel-sched-ir.h
@@ -1147,7 +1147,8 @@ get_all_loop_exits (basic_block bb)

       /* Traverse all loop headers.  */
       for (i = 0; VEC_iterate (edge, exits, i, e); i++)
-       if (in_current_region_p (e->dest))
+       if (in_current_region_p (e->dest)
+           || inner_loop_header_p (e->dest))
          {
            VEC(edge, heap) *next_exits = get_all_loop_exits (e->dest);



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42246


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

* [Bug rtl-optimization/42246] ICE in init_seqno for 186.crafty with sel-sched
  2009-12-01 23:40 [Bug tree-optimization/42246] New: ICE in init_seqno for 186.crafty with sel-sched janis at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2010-01-11 14:35 ` abel at gcc dot gnu dot org
@ 2010-01-14 10:41 ` amonakov at gcc dot gnu dot org
  2010-01-14 11:22 ` abel at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: amonakov at gcc dot gnu dot org @ 2010-01-14 10:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from amonakov at gcc dot gnu dot org  2010-01-14 10:40 -------
Subject: Bug 42246

Author: amonakov
Date: Thu Jan 14 10:40:19 2010
New Revision: 155892

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155892
Log:
2010-01-14  Alexander Monakov  <amonakov@ispras.ru>

        PR rtl-optimization/39453
        PR rtl-optimization/42246
        * sel-sched-ir.c (considered_for_pipelining_p): Do not test
        for pipelining_p.
        (sel_add_loop_preheaders): Add preheader to last_added_blocks.

        * gcc.dg/pr39453.c: New.
        * gcc.dg/pr42246.c: New.


Added:
    trunk/gcc/testsuite/gcc.dg/pr39453.c
    trunk/gcc/testsuite/gcc.dg/pr42246.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/sel-sched-ir.c
    trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42246


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

* [Bug rtl-optimization/42246] ICE in init_seqno for 186.crafty with sel-sched
  2009-12-01 23:40 [Bug tree-optimization/42246] New: ICE in init_seqno for 186.crafty with sel-sched janis at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2010-01-14 10:41 ` amonakov at gcc dot gnu dot org
@ 2010-01-14 11:22 ` abel at gcc dot gnu dot org
  2010-01-14 11:23 ` abel at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: abel at gcc dot gnu dot org @ 2010-01-14 11:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from abel at gcc dot gnu dot org  2010-01-14 11:22 -------
Subject: Bug 42246

Author: abel
Date: Thu Jan 14 11:22:20 2010
New Revision: 155900

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155900
Log:
        PR rtl-optimization/42246
        * sel-sched-ir.h (get_all_loop_exits): Include exits from inner
        loops.


Added:
    trunk/gcc/testsuite/gfortran.dg/pr42246-2.f
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/sel-sched-ir.h
    trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42246


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

* [Bug rtl-optimization/42246] ICE in init_seqno for 186.crafty with sel-sched
  2009-12-01 23:40 [Bug tree-optimization/42246] New: ICE in init_seqno for 186.crafty with sel-sched janis at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2010-01-14 11:22 ` abel at gcc dot gnu dot org
@ 2010-01-14 11:23 ` abel at gcc dot gnu dot org
  2010-02-07  3:52 ` hjl dot tools at gmail dot com
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: abel at gcc dot gnu dot org @ 2010-01-14 11:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from abel at gcc dot gnu dot org  2010-01-14 11:23 -------
Fixed by the above patches.


-- 

abel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42246


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

* [Bug rtl-optimization/42246] ICE in init_seqno for 186.crafty with sel-sched
  2009-12-01 23:40 [Bug tree-optimization/42246] New: ICE in init_seqno for 186.crafty with sel-sched janis at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2010-01-14 11:23 ` abel at gcc dot gnu dot org
@ 2010-02-07  3:52 ` hjl dot tools at gmail dot com
  2010-08-24  8:59 ` abel at gcc dot gnu dot org
  2010-08-24  9:08 ` abel at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-02-07  3:52 UTC (permalink / raw)
  To: gcc-bugs



-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.5.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42246


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

* [Bug rtl-optimization/42246] ICE in init_seqno for 186.crafty with sel-sched
  2009-12-01 23:40 [Bug tree-optimization/42246] New: ICE in init_seqno for 186.crafty with sel-sched janis at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2010-02-07  3:52 ` hjl dot tools at gmail dot com
@ 2010-08-24  8:59 ` abel at gcc dot gnu dot org
  2010-08-24  9:08 ` abel at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: abel at gcc dot gnu dot org @ 2010-08-24  8:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from abel at gcc dot gnu dot org  2010-08-24 08:58 -------
Subject: Bug 42246

Author: abel
Date: Tue Aug 24 08:58:36 2010
New Revision: 163505

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=163505
Log:
Backport from mainline:
 2010-01-14  Alexander Monakov  <amonakov@ispras.ru>

        PR rtl-optimization/39453
        PR rtl-optimization/42246
        * sel-sched-ir.c (considered_for_pipelining_p): Do not test
        for pipelining_p.
        (sel_add_loop_preheaders): Add preheader to last_added_blocks.

        * gcc.dg/pr39453.c: New.
        * gcc.dg/pr42246.c: New.


Added:
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr39453.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr42246.c
Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/sel-sched-ir.c
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42246


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

* [Bug rtl-optimization/42246] ICE in init_seqno for 186.crafty with sel-sched
  2009-12-01 23:40 [Bug tree-optimization/42246] New: ICE in init_seqno for 186.crafty with sel-sched janis at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2010-08-24  8:59 ` abel at gcc dot gnu dot org
@ 2010-08-24  9:08 ` abel at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: abel at gcc dot gnu dot org @ 2010-08-24  9:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from abel at gcc dot gnu dot org  2010-08-24 09:08 -------
Subject: Bug 42246

Author: abel
Date: Tue Aug 24 09:08:23 2010
New Revision: 163513

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=163513
Log:
Backport from mainline:
 PR rtl-optimization/42246
         * sel-sched-ir.h (get_all_loop_exits): Include exits from inner
         loops.


Added:
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/pr42246-2.f
Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/sel-sched-ir.h
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42246


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

end of thread, other threads:[~2010-08-24  9:08 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-01 23:40 [Bug tree-optimization/42246] New: ICE in init_seqno for 186.crafty with sel-sched janis at gcc dot gnu dot org
2009-12-04 18:01 ` [Bug rtl-optimization/42246] " amonakov at gcc dot gnu dot org
2009-12-24  8:32 ` abel at gcc dot gnu dot org
2010-01-06 18:48 ` janis at gcc dot gnu dot org
2010-01-06 18:52 ` janis at gcc dot gnu dot org
2010-01-11 14:35 ` abel at gcc dot gnu dot org
2010-01-14 10:41 ` amonakov at gcc dot gnu dot org
2010-01-14 11:22 ` abel at gcc dot gnu dot org
2010-01-14 11:23 ` abel at gcc dot gnu dot org
2010-02-07  3:52 ` hjl dot tools at gmail dot com
2010-08-24  8:59 ` abel at gcc dot gnu dot org
2010-08-24  9:08 ` abel at gcc dot gnu dot 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).