public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/32349]  New: ICE in df_refs_verify with -O2 -fmodulo-sched for spec tests
@ 2007-06-14 21:09 janis at gcc dot gnu dot org
  2007-06-14 21:12 ` [Bug middle-end/32349] " spark at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: janis at gcc dot gnu dot org @ 2007-06-14 21:09 UTC (permalink / raw)
  To: gcc-bugs

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

Multiple tests in SPEC CPU2000 ICE when compiled with -O2 -fmodulo-sched on
powerpc64-linux with either -m32 or -m64; there are more failures with -m64. 
Here's a cut-down testcase, which I'm sure someone will be able to minimize
even more:


extern long *x1, *x2, *x3;

int
foo ()
{
  /* Switching the following two lines prevents the ICE.  */
  long *p1, *p2;
  long m, n, i;

  p1 = x1;
  p2 = x2;
  n = 0;
  for (i = *x3; 0 < i; i--)
    {
      m = (*p1++) ^ (*p2++);
      m = (m & 0x55555555) + ((m >> 1) & 0x55555555);
      m = (m & 0x33333333) + ((m >> 2) & 0x33333333);
      m = (m + (m >> 4)) & 0x0f0f0f0f;
      m = (m + (m >> 8));
      n += m;
    }
  return n;
}

Output when compiled with trunk revision 125693 (default is -m32):

elm3b145% /opt/gcc-nightly/trunk-20070614/bin/gcc -O2 -fmodulo-sched -c
bug0614-1.c
bug0614-1.c: In function ‘foo’:
bug0614-1.c:23: internal compiler error: in df_refs_verify, at df-scan.c:4066
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.


-- 
           Summary: ICE in df_refs_verify with -O2 -fmodulo-sched for spec
                    tests
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: janis at gcc dot gnu dot org
GCC target triplet: powerpc-unknown-linux-gnu


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


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

* [Bug middle-end/32349] ICE in df_refs_verify with -O2 -fmodulo-sched for spec tests
  2007-06-14 21:09 [Bug middle-end/32349] New: ICE in df_refs_verify with -O2 -fmodulo-sched for spec tests janis at gcc dot gnu dot org
@ 2007-06-14 21:12 ` spark at gcc dot gnu dot org
  2007-06-15  1:25 ` [Bug middle-end/32349] [4.3 Regression] " pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: spark at gcc dot gnu dot org @ 2007-06-14 21:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from spark at gcc dot gnu dot org  2007-06-14 21:12 -------
Kenny, can you take a look ?


-- 

spark at gcc dot gnu dot org changed:

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


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


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

* [Bug middle-end/32349] [4.3 Regression] ICE in df_refs_verify with -O2 -fmodulo-sched for spec tests
  2007-06-14 21:09 [Bug middle-end/32349] New: ICE in df_refs_verify with -O2 -fmodulo-sched for spec tests janis at gcc dot gnu dot org
  2007-06-14 21:12 ` [Bug middle-end/32349] " spark at gcc dot gnu dot org
@ 2007-06-15  1:25 ` pinskia at gcc dot gnu dot org
  2007-06-17 13:51 ` zadeck at naturalbridge dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-06-15  1:25 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
            Summary|ICE in df_refs_verify with -|[4.3 Regression] ICE in
                   |O2 -fmodulo-sched for spec  |df_refs_verify with -O2 -
                   |tests                       |fmodulo-sched for spec tests
   Target Milestone|---                         |4.3.0


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


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

* [Bug middle-end/32349] [4.3 Regression] ICE in df_refs_verify with -O2 -fmodulo-sched for spec tests
  2007-06-14 21:09 [Bug middle-end/32349] New: ICE in df_refs_verify with -O2 -fmodulo-sched for spec tests janis at gcc dot gnu dot org
  2007-06-14 21:12 ` [Bug middle-end/32349] " spark at gcc dot gnu dot org
  2007-06-15  1:25 ` [Bug middle-end/32349] [4.3 Regression] " pinskia at gcc dot gnu dot org
@ 2007-06-17 13:51 ` zadeck at naturalbridge dot com
  2007-06-17 14:14 ` paolo dot bonzini at lu dot unisi dot ch
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: zadeck at naturalbridge dot com @ 2007-06-17 13:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from zadeck at naturalbridge dot com  2007-06-17 13:51 -------
Subject: Re:  [4.3 Regression] ICE in df_refs_verify
 with -O2 -fmodulo-sched for spec tests

This patch fixes the df issues with modulo scheduling.  It simply never
worked and was not tested because there is no default test coverage for it.

I have added the testcase that janis sent me, but this is a completely
inadequate test for this pass. 

Janis did test this fix with the spec benchmarks on the ppc and it did
work. 


The last frag was suggested by stevenb.  If you free the dominance info
before gettting out of cfglayout it is faster since the dominance does
not have to be updated.

2007-06-17  Kenneth Zadeck <zadeck@naturalbridge.com>

    PR middle-end/32349
    * modulo-sched (generate_reg_moves): Added rescan parameter and if
    this is true, rescan insn being modified.
    (sms_schedule): Added rescan parameter.
    (rest_of_handle_sms): Moved freeing of dominance info to before
    getting out of cfg_layout.

2007-06-17  Kenneth Zadeck <zadeck@naturalbridge.com>

    * gcc.c-torture/compile/pr32349.c: New testcase.

ok to commit?

Kenny
Index: testsuite/gcc.c-torture/compile/pr32349.c
===================================================================
--- testsuite/gcc.c-torture/compile/pr32349.c   (revision 0)
+++ testsuite/gcc.c-torture/compile/pr32349.c   (revision 0)
@@ -0,0 +1,26 @@
+/* { dg-options "-O2 -fmodulo-sched" } */
+
+
+extern long *x1, *x2, *x3;
+
+int
+foo ()
+{
+  /* Switching the following two lines prevents the ICE.  */
+  long *p1, *p2;
+  long m, n, i;
+
+  p1 = x1;
+  p2 = x2;
+  n = 0;
+  for (i = *x3; 0 < i; i--)
+    {
+      m = (*p1++) ^ (*p2++);
+      m = (m & 0x55555555) + ((m >> 1) & 0x55555555);
+      m = (m & 0x33333333) + ((m >> 2) & 0x33333333);
+      m = (m + (m >> 4)) & 0x0f0f0f0f;
+      m = (m + (m >> 8));
+      n += m;
+    }
+  return n;
+}
Index: modulo-sched.c
===================================================================
--- modulo-sched.c      (revision 125775)
+++ modulo-sched.c      (working copy)
@@ -426,7 +426,7 @@ calculate_maxii (ddg_ptr g)
                             ii                          { 1 if not.
 */
 static struct undo_replace_buff_elem *
-generate_reg_moves (partial_schedule_ptr ps)
+generate_reg_moves (partial_schedule_ptr ps, bool rescan)
 {
   ddg_ptr g = ps->g;
   int ii = ps->ii;
@@ -523,6 +523,8 @@ generate_reg_moves (partial_schedule_ptr
                }

              replace_rtx (g->nodes[i_use].insn, old_reg, new_reg);
+             if (rescan)
+               df_insn_rescan (g->nodes[i_use].insn);
            }

          prev_reg = new_reg;
@@ -1151,7 +1153,7 @@ sms_schedule (void)

          /* Generate the kernel just to be able to measure its cycles.  */
          permute_partial_schedule (ps, g->closing_branch->first_note);
-         reg_move_replaces = generate_reg_moves (ps);
+         reg_move_replaces = generate_reg_moves (ps, false);

          /* Get the number of cycles the new kernel expect to execute in.  */
          new_cycles = kernel_number_of_cycles (BB_HEAD (g->bb), BB_END
(g->bb));
@@ -1201,7 +1203,7 @@ sms_schedule (void)
              /* The life-info is not valid any more.  */
              df_set_bb_dirty (g->bb);

-             reg_move_replaces = generate_reg_moves (ps);
+             reg_move_replaces = generate_reg_moves (ps, true);
              if (dump_file)
                print_node_sched_params (dump_file, g->num_nodes);
              /* Generate prolog and epilog.  */
@@ -2481,8 +2483,8 @@ rest_of_handle_sms (void)
   FOR_EACH_BB (bb)
     if (bb->next_bb != EXIT_BLOCK_PTR)
       bb->aux = bb->next_bb;
-  cfg_layout_finalize ();
   free_dominance_info (CDI_DOMINATORS);
+  cfg_layout_finalize ();
 #endif /* INSN_SCHEDULING */
   return 0;
 }


-- 


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


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

* [Bug middle-end/32349] [4.3 Regression] ICE in df_refs_verify with -O2 -fmodulo-sched for spec tests
  2007-06-14 21:09 [Bug middle-end/32349] New: ICE in df_refs_verify with -O2 -fmodulo-sched for spec tests janis at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-06-17 13:51 ` zadeck at naturalbridge dot com
@ 2007-06-17 14:14 ` paolo dot bonzini at lu dot unisi dot ch
  2007-06-17 17:51 ` zadeck at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: paolo dot bonzini at lu dot unisi dot ch @ 2007-06-17 14:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from paolo dot bonzini at lu dot unisi dot ch  2007-06-17 14:14 -------
Subject: Re:  [4.3 Regression] ICE in df_refs_verify
 with -O2 -fmodulo-sched for spec tests


> ok to commit?

Yes.

Paolo


-- 


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


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

* [Bug middle-end/32349] [4.3 Regression] ICE in df_refs_verify with -O2 -fmodulo-sched for spec tests
  2007-06-14 21:09 [Bug middle-end/32349] New: ICE in df_refs_verify with -O2 -fmodulo-sched for spec tests janis at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-06-17 14:14 ` paolo dot bonzini at lu dot unisi dot ch
@ 2007-06-17 17:51 ` zadeck at gcc dot gnu dot org
  2007-06-17 17:52 ` zadeck at naturalbridge dot com
  2007-06-17 17:53 ` zadeck at naturalbridge dot com
  6 siblings, 0 replies; 8+ messages in thread
From: zadeck at gcc dot gnu dot org @ 2007-06-17 17:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from zadeck at gcc dot gnu dot org  2007-06-17 17:51 -------
Subject: Bug 32349

Author: zadeck
Date: Sun Jun 17 17:51:25 2007
New Revision: 125776

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=125776
Log:
2007-06-17  Kenneth Zadeck <zadeck@naturalbridge.com>

        PR middle-end/32349
        * modulo-sched (generate_reg_moves): Added rescan parameter and if
        this is true, rescan insn being modified.
        (sms_schedule): Added rescan parameter.
        (rest_of_handle_sms): Moved freeing of dominance info to before
        getting out of cfg_layout.

2007-06-17  Kenneth Zadeck <zadeck@naturalbridge.com>

        * gcc.c-torture/compile/pr32349.c: New testcase.


Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr32349.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/modulo-sched.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug middle-end/32349] [4.3 Regression] ICE in df_refs_verify with -O2 -fmodulo-sched for spec tests
  2007-06-14 21:09 [Bug middle-end/32349] New: ICE in df_refs_verify with -O2 -fmodulo-sched for spec tests janis at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2007-06-17 17:51 ` zadeck at gcc dot gnu dot org
@ 2007-06-17 17:52 ` zadeck at naturalbridge dot com
  2007-06-17 17:53 ` zadeck at naturalbridge dot com
  6 siblings, 0 replies; 8+ messages in thread
From: zadeck at naturalbridge dot com @ 2007-06-17 17:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from zadeck at naturalbridge dot com  2007-06-17 17:52 -------
Subject: Re:  [4.3 Regression] ICE in df_refs_verify
 with -O2 -fmodulo-sched for spec tests

committed as revision 125776

Kenneth Zadeck wrote:
> This patch fixes the df issues with modulo scheduling.  It simply never
> worked and was not tested because there is no default test coverage for it.
>
> I have added the testcase that janis sent me, but this is a completely
> inadequate test for this pass. 
>
> Janis did test this fix with the spec benchmarks on the ppc and it did
> work. 
>
>
> The last frag was suggested by stevenb.  If you free the dominance info
> before gettting out of cfglayout it is faster since the dominance does
> not have to be updated.
>
> 2007-06-17  Kenneth Zadeck <zadeck@naturalbridge.com>
>
>     PR middle-end/32349
>     * modulo-sched (generate_reg_moves): Added rescan parameter and if
>     this is true, rescan insn being modified.
>     (sms_schedule): Added rescan parameter.
>     (rest_of_handle_sms): Moved freeing of dominance info to before
>     getting out of cfg_layout.
>
> 2007-06-17  Kenneth Zadeck <zadeck@naturalbridge.com>
>
>     * gcc.c-torture/compile/pr32349.c: New testcase.
>    
> ok to commit?
>
> Kenny
>   
> ------------------------------------------------------------------------
>
> Index: testsuite/gcc.c-torture/compile/pr32349.c
> ===================================================================
> --- testsuite/gcc.c-torture/compile/pr32349.c	(revision 0)
> +++ testsuite/gcc.c-torture/compile/pr32349.c	(revision 0)
> @@ -0,0 +1,26 @@
> +/* { dg-options "-O2 -fmodulo-sched" } */
> +
> +
> +extern long *x1, *x2, *x3;
> +
> +int
> +foo ()
> +{
> +  /* Switching the following two lines prevents the ICE.  */
> +  long *p1, *p2;
> +  long m, n, i;
> +
> +  p1 = x1;
> +  p2 = x2;
> +  n = 0;
> +  for (i = *x3; 0 < i; i--)
> +    {
> +      m = (*p1++) ^ (*p2++);
> +      m = (m & 0x55555555) + ((m >> 1) & 0x55555555);
> +      m = (m & 0x33333333) + ((m >> 2) & 0x33333333);
> +      m = (m + (m >> 4)) & 0x0f0f0f0f;
> +      m = (m + (m >> 8));
> +      n += m;
> +    }
> +  return n;
> +}
> Index: modulo-sched.c
> ===================================================================
> --- modulo-sched.c	(revision 125775)
> +++ modulo-sched.c	(working copy)
> @@ -426,7 +426,7 @@ calculate_maxii (ddg_ptr g)
>                              ii                          { 1 if not.
>  */
>  static struct undo_replace_buff_elem *
> -generate_reg_moves (partial_schedule_ptr ps)
> +generate_reg_moves (partial_schedule_ptr ps, bool rescan)
>  {
>    ddg_ptr g = ps->g;
>    int ii = ps->ii;
> @@ -523,6 +523,8 @@ generate_reg_moves (partial_schedule_ptr
>  		}
>  
>  	      replace_rtx (g->nodes[i_use].insn, old_reg, new_reg);
> +	      if (rescan)
> +		df_insn_rescan (g->nodes[i_use].insn);
>  	    }
>  
>  	  prev_reg = new_reg;
> @@ -1151,7 +1153,7 @@ sms_schedule (void)
>  
>  	  /* Generate the kernel just to be able to measure its cycles.  */
>  	  permute_partial_schedule (ps, g->closing_branch->first_note);
> -	  reg_move_replaces = generate_reg_moves (ps);
> +	  reg_move_replaces = generate_reg_moves (ps, false);
>  
>  	  /* Get the number of cycles the new kernel expect to execute in.  */
>  	  new_cycles = kernel_number_of_cycles (BB_HEAD (g->bb), BB_END (g->bb));
> @@ -1201,7 +1203,7 @@ sms_schedule (void)
>  	      /* The life-info is not valid any more.  */
>  	      df_set_bb_dirty (g->bb);
>  
> -	      reg_move_replaces = generate_reg_moves (ps);
> +	      reg_move_replaces = generate_reg_moves (ps, true);
>  	      if (dump_file)
>  		print_node_sched_params (dump_file, g->num_nodes);
>  	      /* Generate prolog and epilog.  */
> @@ -2481,8 +2483,8 @@ rest_of_handle_sms (void)
>    FOR_EACH_BB (bb)
>      if (bb->next_bb != EXIT_BLOCK_PTR)
>        bb->aux = bb->next_bb;
> -  cfg_layout_finalize ();
>    free_dominance_info (CDI_DOMINATORS);
> +  cfg_layout_finalize ();
>  #endif /* INSN_SCHEDULING */
>    return 0;
>  }
>   


-- 


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


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

* [Bug middle-end/32349] [4.3 Regression] ICE in df_refs_verify with -O2 -fmodulo-sched for spec tests
  2007-06-14 21:09 [Bug middle-end/32349] New: ICE in df_refs_verify with -O2 -fmodulo-sched for spec tests janis at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2007-06-17 17:52 ` zadeck at naturalbridge dot com
@ 2007-06-17 17:53 ` zadeck at naturalbridge dot com
  6 siblings, 0 replies; 8+ messages in thread
From: zadeck at naturalbridge dot com @ 2007-06-17 17:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from zadeck at naturalbridge dot com  2007-06-17 17:53 -------
fixed as committed.


-- 

zadeck at naturalbridge dot com changed:

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


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


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

end of thread, other threads:[~2007-06-17 17:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-14 21:09 [Bug middle-end/32349] New: ICE in df_refs_verify with -O2 -fmodulo-sched for spec tests janis at gcc dot gnu dot org
2007-06-14 21:12 ` [Bug middle-end/32349] " spark at gcc dot gnu dot org
2007-06-15  1:25 ` [Bug middle-end/32349] [4.3 Regression] " pinskia at gcc dot gnu dot org
2007-06-17 13:51 ` zadeck at naturalbridge dot com
2007-06-17 14:14 ` paolo dot bonzini at lu dot unisi dot ch
2007-06-17 17:51 ` zadeck at gcc dot gnu dot org
2007-06-17 17:52 ` zadeck at naturalbridge dot com
2007-06-17 17:53 ` zadeck at naturalbridge dot com

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