Hi!

While gen_move_insn returns an INSN (or more), gen_add3_insn can return
just the pattern of an insn.  The rest of the function and the helper
called through note_stores assumes it is always instruction, so this
patch ensures it.
Bootstrapped/regtested on x86_64-linux and i686-linux and tested with cris
cross on the testcase from the PR, ok for trunk?

2011-11-30  Jakub Jelinek  <ja...@redhat.com>

        PR rtl-optimization/51044
        * dse.c (emit_inc_dec_insn_before): Ensure new_insn is an instruction
        rather than just insn body.

--- gcc/dse.c.jj        2011-11-07 12:40:56.000000000 +0100
+++ gcc/dse.c   2011-11-29 10:56:31.852909647 +0100
@@ -895,7 +895,12 @@ emit_inc_dec_insn_before (rtx mem ATTRIB
   /* We can reuse all operands without copying, because we are about
      to delete the insn that contained it.  */
   if (srcoff)
-    new_insn = gen_add3_insn (dest, src, srcoff);
+    {
+      start_sequence ();
+      emit_insn (gen_add3_insn (dest, src, srcoff));
+      new_insn = get_insns ();
+      end_sequence ();
+    }
   else
     new_insn = gen_move_insn (dest, src);
   info.first = new_insn;

        Jakub

Reply via email to