Patchwork RFA: MEP: Fix use of delete_insn.

login
register
mail settings
Submitter Nick Clifton
Date June 29, 2012, 8:48 a.m.
Message ID <87d34isdvd.fsf@redhat.com>
Download mbox | patch
Permalink /patch/168020/
State New
Headers show

Comments

Nick Clifton - June 29, 2012, 8:48 a.m.
Hi DJ,

  The delete_insn() function no longer returns the insn after the one
  that has been deleted, so gcc/config/mep/mep.c:mep_reorg_regmove() no
  longer compiles.  The patch below is a simple fix for the problem, but
  I was not sure whether it would be better to use
  next_nonnote_nondebug_insn() instead.  What do you think ?

Cheers
  Nick

gcc/ChangeLog
2012-06-29  Nick Clifton  <nickc@redhat.com>

	* config/mep/mep.c (mep_reorg_regmove): Get next insn before
	calling delete_insn.
DJ Delorie - June 29, 2012, 6:44 p.m.
We have this at the top of the loop, so I don't think it matters:

	  next = NEXT_INSN (insn);
	  if (GET_CODE (insn) != INSN)
	    continue;

However, I think an insn will be skipped if we use NEXT.  Perhaps we
want PREV?  Or the loop might need to be altered to account for this
potential skipping.

Patch

Index: gcc/config/mep/mep.c
===================================================================
--- gcc/config/mep/mep.c	(revision 189064)
+++ gcc/config/mep/mep.c	(working copy)
@@ -5096,7 +5096,8 @@ 
 					       follow, where))
 		{
 		  count ++;
-		  next = delete_insn (insn);
+		  next = NEXT_INSN (insn);
+		  delete_insn (insn);
 		  if (dump_file)
 		    {
 		      fprintf (dump_file, "\n----- Success!  new insn:\n\n");