OSDN Git Service

PR c++/23287
[pf3gnuchains/gcc-fork.git] / gcc / regmove.c
index 925cb9d..12b93fc 100644 (file)
@@ -193,16 +193,15 @@ try_auto_increment (rtx insn, rtx inc_insn, rtx inc_insn_set, rtx reg,
                  /* If there is a REG_DEAD note on this insn, we must
                     change this not to REG_UNUSED meaning that the register
                     is set, but the value is dead.  Failure to do so will
-                    result in a sched1 dieing -- when it recomputes lifetime
+                    result in sched1 dying -- when it recomputes lifetime
                     information, the number of REG_DEAD notes will have
                     changed.  */
                  rtx note = find_reg_note (insn, REG_DEAD, reg);
                  if (note)
                    PUT_MODE (note, REG_UNUSED);
 
-                 REG_NOTES (insn)
-                   = gen_rtx_EXPR_LIST (REG_INC,
-                                        reg, REG_NOTES (insn));
+                 add_reg_note (insn, REG_INC, reg);
+
                  if (! inc_insn_set)
                    delete_insn (inc_insn);
                  return 1;
@@ -686,7 +685,15 @@ optimize_reg_copy_2 (rtx insn, rtx dest, rtx src)
              {
                if (reg_mentioned_p (dest, PATTERN (q)))
                  {
+                   rtx note;
+
                    PATTERN (q) = replace_rtx (PATTERN (q), dest, src);
+                   note = FIND_REG_INC_NOTE (q, dest);
+                   if (note)
+                     {
+                       remove_note (q, note);
+                       add_reg_note (q, REG_INC, src);
+                     }
                    df_insn_rescan (q);
                  }
 
@@ -916,7 +923,7 @@ reg_is_remote_constant_p (rtx reg, rtx insn)
   if (!reg_set_in_bb)
     {
       max_reg_computed = max = max_reg_num ();
-      reg_set_in_bb = xcalloc (max, sizeof (*reg_set_in_bb));
+      reg_set_in_bb = XCNEWVEC (basic_block, max);
 
       FOR_EACH_BB (bb)
        FOR_BB_INSNS (bb, p)
@@ -1118,7 +1125,8 @@ regmove_optimize (rtx f, int nregs)
 
   for (pass = 0; pass <= 2; pass++)
     {
-      if (! flag_regmove && pass >= flag_expensive_optimizations)
+      /* We need fewer optimizations for IRA.  */
+      if ((! flag_regmove || flag_ira) && pass >= flag_expensive_optimizations)
        goto done;
 
       if (dump_file)
@@ -1166,7 +1174,9 @@ regmove_optimize (rtx f, int nregs)
                    }
                }
            }
-         if (! flag_regmove)
+
+         /* All optimizations important for IRA have been done.  */
+         if (! flag_regmove || flag_ira)
            continue;
 
          if (! find_matches (insn, &match))