This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH COMMITTED: PR 32776: lower-subreg remove reg notes on clobbers


PR 32776 is about a case which arises on m32-elf.  For some reason in
the test case in the PR (derived from newlib) a clobber will get a
reg_unused note.  The lower-subreg pass will decompose the clobbered
register.  Unfortunately it will fail to remove the reg note, thus
leaving it pointing at the decomposed concatn rtx.  This is unwise,
and causes a crash when using --enable-checking=rtl.

This patch fixes the problem.  I also noticed that we no longer need
the local variable "changed" in decompose_multiword_subregs (it's only
use was removed during DF integration), so I removed it.

Bootstrapped and tested on i686-pc-linux-gnu.  Committed.

Ian


2007-08-07  Ian Lance Taylor  <iant@google.com>

	PR rtl-optimization/32776
	* lower-subreg.c (resolve_clobber): Call resolve_reg_notes.
	(resolve_use): Likewise.
	(decompose_multiword_subregs): Remove "changed" local variable.


Index: lower-subreg.c
===================================================================
--- lower-subreg.c	(revision 127281)
+++ lower-subreg.c	(working copy)
@@ -936,6 +936,8 @@ resolve_clobber (rtx pat, rtx insn)
       emit_insn_after (x, insn);
     }
 
+  resolve_reg_notes (insn);
+
   return true;
 }
 
@@ -950,6 +952,9 @@ resolve_use (rtx pat, rtx insn)
       delete_insn (insn);
       return true;
     }
+
+  resolve_reg_notes (insn);
+
   return false;
 }
 
@@ -1251,25 +1256,17 @@ decompose_multiword_subregs (void)
 	  FOR_BB_INSNS (bb, insn)
 	    {
 	      rtx next, pat;
-	      bool changed;
 
 	      if (!INSN_P (insn))
 		continue;
 
 	      next = NEXT_INSN (insn);
-	      changed = false;
 
 	      pat = PATTERN (insn);
 	      if (GET_CODE (pat) == CLOBBER)
-		{
-		  if (resolve_clobber (pat, insn))
-		    changed = true;
-		}
+		resolve_clobber (pat, insn);
 	      else if (GET_CODE (pat) == USE)
-		{
-		  if (resolve_use (pat, insn))
-		    changed = true;
-		}
+		resolve_use (pat, insn);
 	      else
 		{
 		  rtx set;
@@ -1302,8 +1299,6 @@ decompose_multiword_subregs (void)
 		      insn = resolve_simple_move (set, insn);
 		      if (insn != orig_insn)
 			{
-			  changed = true;
-
 			  remove_retval_note (insn);
 
 			  recog_memoized (insn);
@@ -1320,7 +1315,6 @@ decompose_multiword_subregs (void)
 		      decomposed_shift = resolve_shift_zext (insn);
 		      if (decomposed_shift != NULL_RTX)
 			{
-			  changed = true;
 			  insn = decomposed_shift;
 			  recog_memoized (insn);
 			  extract_insn (insn);
@@ -1349,8 +1343,6 @@ decompose_multiword_subregs (void)
 		      gcc_assert (i);
 
 		      remove_retval_note (insn);
-
-		      changed = true;
 		    }
 		}
 	    }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]