This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH COMMITTED: Fix init-regs to handle multi-insn move correctly
- From: Ian Lance Taylor <iant at google dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: hp at axis dot com, zadeck at naturalbridge dot com
- Date: 05 Sep 2007 13:55:12 -0700
- Subject: PATCH COMMITTED: Fix init-regs to handle multi-insn move correctly
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",