Remove unnecesary line number notes

Jan Hubicka jh@suse.cz
Thu Nov 9 22:38:00 GMT 2006


> On Wed, Nov 08, 2006 at 05:45:18PM +0100, Jan Hubicka wrote:
> > > Jan Hubicka <jh@suse.cz> writes:
> > > 
> > > > 2006-07-25  Jan Hubicka  <jh@suse.cz>
> > > > 	* cfglayout.c (insn_locators_initialize): Delete line number insn.
> > > 
> > > This is OK.
> > Hi,
> > I was holding this patch, because there was reported extra failure in
> > GDB testsuite (weird looking one caused by no longer duplicated line
> > number info).  I've re-tested with new mainline and gdb-6.5 and
> > everything looks fine now, so I am going to commit it.
> 
> Did you check that duplicate line number notes are emitted where they
> ought to be?  Otherwise, I bet the problem just doesn't appear on
> whichever platform you tested it...
Hi,
the problem has turned out to be rather simple mistake in final.c that
makes the loop to always skip first instruction.
Since this first instruction used to be line number note, but now it is
often function beg note, the walker then never emit the duplicated line
info.

I am testing the attached patch and will commit it if it passes, as the
change is rather obvious.  As incremental cleanups, I think
reorganization of the notes is quite neccesary.  It is not dificult to
come with testcases where this code fails even at -O0 code, for instance
on x86-64 with variadic functions.

Honza

Index: final.c
===================================================================
--- final.c	(revision 118618)
+++ final.c	(working copy)
@@ -1594,7 +1594,7 @@ final (rtx first, FILE *file, int optimi
   CC_STATUS_INIT;
 
   /* Output the insns.  */
-  for (insn = NEXT_INSN (first); insn;)
+  for (insn = first; insn;)
     {
 #ifdef HAVE_ATTR_length
       if ((unsigned) INSN_UID (insn) >= INSN_ADDRESSES_SIZE ())
Index: cfglayout.c
===================================================================
--- cfglayout.c	(revision 118618)
+++ cfglayout.c	(working copy)
@@ -277,6 +277,7 @@ insn_locators_initialize (void)
 	      NOTE_EXPANDED_LOCATION (xloc, insn);
 	      line_number = xloc.line;
 	      file_name = xloc.file;
+	      delete_insn (insn);
 	    }
 	}
       else



More information about the Gcc-patches mailing list