PATCH COMMITTED: Fix init-regs to handle multi-insn move correctly

Ian Lance Taylor iant@google.com
Wed Sep 5 20:59:00 GMT 2007


When I committed Steven's patch to lower-subreg.c, it exposed a bug in
cris-elf.  This bug turned out to be in init-regs.c.  The code in
init-regs.c looks like this:

		  start_sequence ();
		  emit_move_insn (reg, CONST0_RTX (GET_MODE (reg)));
		  move_insn = get_insns ();
		  end_sequence ();
		  add_insn_before (move_insn, insn, bb);

The problem is that add_insn_before explicitly adds a single insn.
That's not what we want here.  We want to add all the insns in the
sequence.  In many cases the sequence will be a single insn.  On CRIS
it turns out not to be.

This patch fixes the problem in the obvious way.  Bootstrapped and
tested on i686-pc-linux-gnu.  Committed.

Ian


2007-09-05  Ian Lance Taylor  <iant@google.com>

	* init-regs.c (initialize_uninitialized_regs): Call
	emit_insn_before rather than add_insn_before.



Index: init-regs.c
===================================================================
--- init-regs.c	(revision 128122)
+++ init-regs.c	(working copy)
@@ -106,7 +106,7 @@ initialize_uninitialized_regs (void)
 		  emit_move_insn (reg, CONST0_RTX (GET_MODE (reg)));
 		  move_insn = get_insns ();
 		  end_sequence ();
-		  add_insn_before (move_insn, insn, bb);
+		  emit_insn_before (move_insn, insn);
 		  if (dump_file)
 		    fprintf (dump_file, 
 			     "adding initialization in %s of reg %d at in block %d for insn %d.\n", 



More information about the Gcc-patches mailing list