Patchwork [PR52983,PR48866] eliminate autoinc from debug_insn locs

login
register
mail settings
Submitter Alexandre Oliva
Date May 3, 2012, 10:46 p.m.
Message ID <orlil8yjba.fsf_-_@livre.localdomain>
Download mbox | patch
Permalink /patch/156782/
State New
Headers show

Comments

Alexandre Oliva - May 3, 2012, 10:46 p.m.
On May  3, 2012, Alexandre Oliva <aoliva@redhat.com> wrote:

> My recent patch for PR48866

... had some inconsistency in behavior between dce and word_dce, as you
pointed out.  I couldn't find any reason for that, so I made them the
same.

Regstrapped on x86_64-linux-gnu and i686-linux-gnu, no regressions
detected by the testsuite, but I'm concerned about potential debug info
regressions, which I'm yet to test.

Once I'm convinced it doesn't regress debug info, is this ok to install?
Alexandre Oliva - June 13, 2012, 8:46 a.m.
On May  3, 2012, Alexandre Oliva <aoliva@redhat.com> wrote:

> On May  3, 2012, Alexandre Oliva <aoliva@redhat.com> wrote:
>> My recent patch for PR48866

> ... had some inconsistency in behavior between dce and word_dce, as you
> pointed out.  I couldn't find any reason for that, so I made them the
> same.

> Regstrapped on x86_64-linux-gnu and i686-linux-gnu

> for  gcc/ChangeLog
> from  Alexandre Oliva  <aoliva@redhat.com>

> 	PR debug/52983
> 	PR debug/48866
> 	* dce.c (word_dce_process_block): Insert debug temps only if the
> 	insn is not marked.
> 	(dce_process_block): Likewise, and if debug.used is not empty,
> 	and only after iterating over all DEFs that might mark the insn.

Ping?  http://gcc.gnu.org/ml/gcc-patches/2012-05/msg00301.html
Jakub Jelinek - June 13, 2012, 8:55 a.m.
On Wed, Jun 13, 2012 at 05:46:47AM -0300, Alexandre Oliva wrote:
> On May  3, 2012, Alexandre Oliva <aoliva@redhat.com> wrote:
> 
> > On May  3, 2012, Alexandre Oliva <aoliva@redhat.com> wrote:
> >> My recent patch for PR48866
> 
> > ... had some inconsistency in behavior between dce and word_dce, as you
> > pointed out.  I couldn't find any reason for that, so I made them the
> > same.
> 
> > Regstrapped on x86_64-linux-gnu and i686-linux-gnu
> 
> > for  gcc/ChangeLog
> > from  Alexandre Oliva  <aoliva@redhat.com>
> 
> > 	PR debug/52983
> > 	PR debug/48866
> > 	* dce.c (word_dce_process_block): Insert debug temps only if the
> > 	insn is not marked.
> > 	(dce_process_block): Likewise, and if debug.used is not empty,
> > 	and only after iterating over all DEFs that might mark the insn.
> 
> Ping?  http://gcc.gnu.org/ml/gcc-patches/2012-05/msg00301.html

Ok.  Thanks.

	Jakub

Patch

for  gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	PR debug/52983
	PR debug/48866
	* dce.c (word_dce_process_block): Insert debug temps only if the
	insn is not marked.
	(dce_process_block): Likewise, and if debug.used is not empty,
	and only after iterating over all DEFs that might mark the insn.

Index: gcc/dce.c
===================================================================
--- gcc/dce.c.orig	2012-05-03 15:49:35.324670988 -0300
+++ gcc/dce.c	2012-05-03 15:57:33.000000000 -0300
@@ -858,8 +858,9 @@  word_dce_process_block (basic_block bb, 
 	   anything in local_live.  */
 	if (marked_insn_p (insn))
 	  df_word_lr_simulate_uses (insn, local_live);
-
-	if (debug.used && !bitmap_empty_p (debug.used))
+	/* Insert debug temps for dead REGs used in subsequent debug
+	   insns.  */
+	else if (debug.used && !bitmap_empty_p (debug.used))
 	  {
 	    df_ref *def_rec;
 
@@ -940,18 +941,13 @@  dce_process_block (basic_block bb, bool 
 	/* The insn is needed if there is someone who uses the output.  */
 	if (!needed)
 	  for (def_rec = DF_INSN_DEFS (insn); *def_rec; def_rec++)
-	    {
-	      dead_debug_insert_temp (&debug, DF_REF_REGNO (*def_rec), insn,
-				      DEBUG_TEMP_BEFORE_WITH_VALUE);
-
-	      if (bitmap_bit_p (local_live, DF_REF_REGNO (*def_rec))
-		  || bitmap_bit_p (au, DF_REF_REGNO (*def_rec)))
-		{
-		  needed = true;
-		  mark_insn (insn, true);
-		  break;
-		}
-	    }
+	    if (bitmap_bit_p (local_live, DF_REF_REGNO (*def_rec))
+		|| bitmap_bit_p (au, DF_REF_REGNO (*def_rec)))
+	      {
+		needed = true;
+		mark_insn (insn, true);
+		break;
+	      }
 
 	/* No matter if the instruction is needed or not, we remove
 	   any regno in the defs from the live set.  */
@@ -961,6 +957,12 @@  dce_process_block (basic_block bb, bool 
 	   anything in local_live.  */
 	if (needed)
 	  df_simulate_uses (insn, local_live);
+	/* Insert debug temps for dead REGs used in subsequent debug
+	   insns.  */
+	else if (debug.used && !bitmap_empty_p (debug.used))
+	  for (def_rec = DF_INSN_DEFS (insn); *def_rec; def_rec++)
+	    dead_debug_insert_temp (&debug, DF_REF_REGNO (*def_rec), insn,
+				    DEBUG_TEMP_BEFORE_WITH_VALUE);
       }
 
   dead_debug_finish (&debug, NULL);