[Bug target/32481] ICE in df_refs_verify, at df-scan.c:4058

2007-10-04 Thread zadeck at naturalbridge dot com


--- Comment #11 from zadeck at naturalbridge dot com  2007-10-04 20:51 
---
spark fixed this in comment #10.


-- 

zadeck at naturalbridge dot com changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


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



[Bug target/32481] ICE in df_refs_verify, at df-scan.c:4058

2007-06-27 Thread spark at gcc dot gnu dot org


--- Comment #10 from spark at gcc dot gnu dot org  2007-06-27 18:17 ---
Subject: Bug 32481

Author: spark
Date: Wed Jun 27 18:17:15 2007
New Revision: 126058

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=126058
Log:
2007-06-27  Seongbae Park  [EMAIL PROTECTED]

PR rtl-optimization/32481
* combine.c (adjust_for_new_dest): Rescan the changed insn.


Modified:
trunk/gcc/ChangeLog
trunk/gcc/combine.c


-- 


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



[Bug target/32481] ICE in df_refs_verify, at df-scan.c:4058

2007-06-26 Thread zadeck at naturalbridge dot com


--- Comment #9 from zadeck at naturalbridge dot com  2007-06-26 23:01 
---
Subject: Re:  [Bug target/32437] ICE in df_refs_verify,
 at df-scan.c:4058

This patch fixes a problem introduced with the patch to fix pr32437.
In that patch we introduced recursion in dce:deleteable_insn_p in order
to properly process UNSPECs that occur inside of PARALLELS.  When we did
that, we went too far and introduced problems with CLOBBERs and USEs
that occur inside of PARALLELs.  This patch fixes that. 

This patch has the side effect of making the bug reported in pr32481
hide, but the bug is still there.

The underlying problem is that there is a rarely executed path in
combine:try_combine that does not undo the changes it makes when the
transformation fails.  We are waiting to talk to iant (or any other
combine expert) to determine if the bug is that it is not undoing what
it needs to or that we need to rescan the changes because that change is
not supposed to be undone.  Our attempts to make the undo work on our
own have only resulted in death and destruction.

Kenny

2007-06-26  Kenneth Zadeck [EMAIL PROTECTED]

PR middle-end/32481
*dce.c (deletable_insn_p): Add extra parameter to indicate top
level.  Restructure to process USE and CLOBBER differently.
(prescan_insns_for_dce): Add extra parameter.





Index: dce.c
===
--- dce.c   (revision 126045)
+++ dce.c   (working copy)
@@ -59,15 +59,54 @@ static bitmap_obstack dce_tmp_bitmap_obs
 static sbitmap marked = NULL;

 /* Return true if INSN with BODY is a normal instruction that can be
-   deleted by the DCE pass.  */
+   deleted by the DCE pass.  STRICT_TOP_LEVEL is false if this is a
+   recursive call.  See the note above the CLOBBER case */

 static bool
-deletable_insn_p (rtx insn, rtx body, bool fast)
+deletable_insn_p (rtx insn, rtx body, bool fast, bool strict_top_level)
 {
   rtx x;
+
+  if (!NONJUMP_INSN_P (insn))
+return false;
+  
   switch (GET_CODE (body))
 {
+case CLOBBER:
+  /* A CLOBBER at the strict_top_level (i.e. not inside of a
+parallel) is different than one that is inside of a parallel.
+Strict_top_level CLOBBERS are put there for some possibly
+magic purpose.  
+
+However, a clobber inside of a parallel means that this part
+of the insn just messes with a register while the real work
+is done by the other arms. These clobbers do not effect our
+ability to delete the insn.  */
+  if (strict_top_level)
+   {
+ if (fast)
+   {
+ /* A CLOBBER of a dead pseudo register serves no purpose.
+That is not necessarily true for hard registers until
+after reload.  */
+ x = XEXP (body, 0);
+ return REG_P (x)  (!HARD_REGISTER_P (x) || reload_completed);
+   }
+ else 
+   /* Because of the way that use-def chains are built, it is not
+  possible to tell if the clobber is dead because it can
+  never be the target of a use-def chain.  */
+   return false;
+   }
+  break;
+
 case USE:
+  /* Strict top level uses can never be deleted.  All others are
+noise.  */
+  if (strict_top_level)
+   return false;
+  break;
+
 case PREFETCH:
 case TRAP_IF:
   /* The UNSPEC case was added here because the ia-64 claims that
@@ -79,42 +118,27 @@ deletable_insn_p (rtx insn, rtx body, bo
 case UNSPEC:
   return false;

-case CLOBBER:
-  if (fast)
-   {
- /* A CLOBBER of a dead pseudo register serves no purpose.
-That is not necessarily true for hard registers until
-after reload.  */
- x = XEXP (body, 0);
- return REG_P (x)  (!HARD_REGISTER_P (x) || reload_completed);
-   }
-  else 
-   /* Because of the way that use-def chains are built, it is not
-  possible to tell if the clobber is dead because it can
-  never be the target of a use-def chain.  */
-   return false;
-
 case PARALLEL:
   {
int i;
+   gcc_assert (strict_top_level);
for (i = XVECLEN (body, 0) - 1; i = 0; i--)
- if (!deletable_insn_p (insn, XVECEXP (body, 0, i), fast))
+ if (!deletable_insn_p (insn, XVECEXP (body, 0, i), fast, false))
return false;
-   return true;
+   break;
   }

 default:
-  if (!NONJUMP_INSN_P (insn))
-   return false;
-
-  if (volatile_insn_p (body))
-   return false;
-
-  if (flag_non_call_exceptions  may_trap_p (body))
-   return false;
-
-  return true;
+  break;
 }
+
+  if (volatile_insn_p (body))
+return false;
+  
+  if (flag_non_call_exceptions  may_trap_p (body))
+return false;
+  
+  return true;
 }


@@ -369,7 +393,7 @@ prescan_insns_for_dce (bool fast)
 rtx note = find_reg_note (insn, REG_LIBCALL_ID, 

[Bug target/32481] ICE in df_refs_verify, at df-scan.c:4058

2007-06-25 Thread spark at gcc dot gnu dot org


-- 

spark at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||zadeck at gcc dot gnu dot
   ||org
 AssignedTo|zadeck at gcc dot gnu dot   |spark at gcc dot gnu dot org
   |org |
 Status|UNCONFIRMED |ASSIGNED
 Ever Confirmed|0   |1
   Last reconfirmed|-00-00 00:00:00 |2007-06-25 16:04:55
   date||


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



[Bug target/32481] ICE in df_refs_verify, at df-scan.c:4058

2007-06-25 Thread spark at gcc dot gnu dot org


-- 

spark at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|spark at gcc dot gnu dot org|unassigned at gcc dot gnu
   ||dot org
 Status|ASSIGNED|NEW


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



[Bug target/32481] ICE in df_refs_verify, at df-scan.c:4058

2007-06-25 Thread spark at gcc dot gnu dot org


-- 

spark at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |zadeck at gcc dot gnu dot
   |dot org |org
 Status|NEW |ASSIGNED


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



[Bug target/32481] ICE in df_refs_verify, at df-scan.c:4058

2007-06-25 Thread zadeck at naturalbridge dot com


--- Comment #3 from zadeck at naturalbridge dot com  2007-06-25 19:29 
---
I cannot recreate this bug.  

I have tried building both 32 and 64 bit compilers with both revision 125972
and the current 126001.  

All of my machines are suse, so if this requires someone elses abi, I am out of
luck.


-- 


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



[Bug target/32481] ICE in df_refs_verify, at df-scan.c:4058

2007-06-25 Thread marcus at jet dot franken dot de


--- Comment #4 from marcus at jet dot franken dot de  2007-06-25 19:57 
---
I am using 10.2-x86_64 with the compiler built with
./configure --enable-languages=c
and at r126002

gdb
(gdb) bt
#0  fancy_abort (file=0xab29a0 /home/marcus/projects/gcc/gcc/df-scan.c,
line=4058, function=0xab33ae df_refs_verify)
at /home/marcus/projects/gcc/gcc/diagnostic.c:655
#1  0x004fbfe0 in df_refs_verify (new_rec=value optimized out,
old_rec=value optimized out, abort_if_fail=1 '\001')
at /home/marcus/projects/gcc/gcc/df-scan.c:4058
#2  0x0050071d in df_insn_refs_verify (collection_rec=0x7fff2aef8540,
bb=value optimized out, insn=value optimized out, 
abort_if_fail=1 '\001') at /home/marcus/projects/gcc/gcc/df-scan.c:4143
#3  0x0050098f in df_bb_verify (bb=0x2b4680799900) at
/home/marcus/projects/gcc/gcc/df-scan.c:4179
#4  0x00500c58 in df_scan_verify () at
/home/marcus/projects/gcc/gcc/df-scan.c:4318
#5  0x004f1e79 in df_verify () at
/home/marcus/projects/gcc/gcc/df-core.c:1513
#6  0x004f29e9 in df_analyze () at
/home/marcus/projects/gcc/gcc/df-core.c:1106
#7  0x009e3e9a in if_convert (recompute_dominance=1 '\001') at
/home/marcus/projects/gcc/gcc/ifcvt.c:3992
#8  0x009e4978 in rest_of_handle_if_after_combine () at
/home/marcus/projects/gcc/gcc/ifcvt.c:4109
#9  0x0061d4d9 in execute_one_pass (pass=0xe57960) at
/home/marcus/projects/gcc/gcc/passes.c:1125
#10 0x0061d6c0 in execute_pass_list (pass=0xe57960) at
/home/marcus/projects/gcc/gcc/passes.c:1178
#11 0x0061d6d5 in execute_pass_list (pass=0xe532c0) at
/home/marcus/projects/gcc/gcc/passes.c:1179
#12 0x006ee418 in tree_rest_of_compilation (fndecl=0x2b21f67c9900) at
/home/marcus/projects/gcc/gcc/tree-optimize.c:406
#13 0x0083e270 in cgraph_expand_function (node=0x2b21f67c9a00) at
/home/marcus/projects/gcc/gcc/cgraphunit.c:1073
#14 0x0084079a in cgraph_optimize () at
/home/marcus/projects/gcc/gcc/cgraphunit.c:1142
#15 0x0041553e in c_write_global_declarations () at
/home/marcus/projects/gcc/gcc/c-decl.c:7911
#16 0x0069a7bd in toplev_main (argc=value optimized out, argv=value
optimized out)
at /home/marcus/projects/gcc/gcc/toplev.c:1064

(gdb) up
#1  0x004fbfe0 in df_refs_verify (new_rec=value optimized out,
old_rec=value optimized out, abort_if_fail=1 '\001')
at /home/marcus/projects/gcc/gcc/df-scan.c:4058
4058gcc_assert (0);

unsure what debug to add here 


-- 


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



[Bug target/32481] ICE in df_refs_verify, at df-scan.c:4058

2007-06-25 Thread zadeck at naturalbridge dot com


--- Comment #5 from zadeck at naturalbridge dot com  2007-06-25 20:04 
---
sorry, pilot error on my part, i am too embarrassed to actually tell you what i
did.


-- 


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



[Bug target/32481] ICE in df_refs_verify, at df-scan.c:4058

2007-06-25 Thread spark at gcc dot gnu dot org


--- Comment #6 from spark at gcc dot gnu dot org  2007-06-25 23:13 ---
This patch:

diff -r 36792eca786a gcc/combine.c
--- a/gcc/combine.c Sat Jun 23 16:21:43 2007 +
+++ b/gcc/combine.c Mon Jun 25 23:10:32 2007 +
@@ -2849,6 +2849,7 @@ try_combine (rtx i3, rtx i2, rtx i1, int

  PATTERN (i3) = newpat;
  adjust_for_new_dest (i3);
+ df_insn_rescan (i3);
}
}
 }

at least fixes the immediate problem,
though it's not yet completely clear whether this is the right approach
as I don't know whether the PATTERN (i3) change above 
is supposed to be permanent or not.


-- 


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



[Bug target/32481] ICE in df_refs_verify, at df-scan.c:4058

2007-06-25 Thread spark at gcc dot gnu dot org


--- Comment #7 from spark at gcc dot gnu dot org  2007-06-25 23:25 ---
As David suggested, this might be a slightly better fix:

diff -r 36792eca786a gcc/combine.c
--- a/gcc/combine.c Sat Jun 23 16:21:43 2007 +
+++ b/gcc/combine.c Mon Jun 25 23:23:23 2007 +
@@ -2057,6 +2057,8 @@ adjust_for_new_dest (rtx insn)
  of an insn just above it.  Call distribute_links to make a LOG_LINK from
  the next use of that destination.  */
   distribute_links (gen_rtx_INSN_LIST (VOIDmode, insn, NULL_RTX));
+
+  df_insn_rescan (insn);
 }

 /* Return TRUE if combine can reuse reg X in mode MODE.


though I'm still not sure whether this is the right approach in general.


-- 


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



[Bug target/32481] ICE in df_refs_verify, at df-scan.c:4058

2007-06-25 Thread zadeck at naturalbridge dot com


--- Comment #8 from zadeck at naturalbridge dot com  2007-06-25 23:27 
---
Subject: Re:  ICE in df_refs_verify, at df-scan.c:4058

spark at gcc dot gnu dot org wrote:
 --- Comment #6 from spark at gcc dot gnu dot org  2007-06-25 23:13 ---
 This patch:

 diff -r 36792eca786a gcc/combine.c
 --- a/gcc/combine.c Sat Jun 23 16:21:43 2007 +
 +++ b/gcc/combine.c Mon Jun 25 23:10:32 2007 +
 @@ -2849,6 +2849,7 @@ try_combine (rtx i3, rtx i2, rtx i1, int

   PATTERN (i3) = newpat;
   adjust_for_new_dest (i3);
 + df_insn_rescan (i3);
 }
 }
  }

 at least fixes the immediate problem,
 though it's not yet completely clear whether this is the right approach
 as I don't know whether the PATTERN (i3) change above 
 is supposed to be permanent or not.


   
do not do this.  this is the wrong fix for the problem.  wait till 
tomorrow to talk to iant.


-- 


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



[Bug target/32481] ICE in df_refs_verify, at df-scan.c:4058

2007-06-24 Thread pinskia at gcc dot gnu dot org


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||spark at gcc dot gnu dot
   ||org, pinskia at gcc dot gnu
   ||dot org
  Component|c   |target
   Keywords||ice-on-valid-code
   Target Milestone|--- |4.3.0


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



[Bug target/32481] ICE in df_refs_verify, at df-scan.c:4058

2007-06-24 Thread spark at gcc dot gnu dot org


--- Comment #2 from spark at gcc dot gnu dot org  2007-06-25 05:30 ---
Confirmed. 
The following commit:

r125972 | zadeck | 2007-06-23 09:21:43 -0700 (Sat, 23 Jun 2007) | 8 lines

2007-06-23  Kenneth Zadeck [EMAIL PROTECTED]

PR middle-end/32437
*dce.c (deletable_insn_p): Add extra parameter and recurse if insn
is a PARALLEL.
(prescan_insns_for_dce): Add extra parameter.


causes the problem.


-- 

spark at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |zadeck at gcc dot gnu dot
   |dot org |org


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