]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorMatthias Klose <doko@debian.org>
Tue, 25 Feb 2003 09:22:32 +0000 (09:22 +0000)
committerMatthias Klose <doko@gcc.gnu.org>
Tue, 25 Feb 2003 09:22:32 +0000 (09:22 +0000)
2003-02-25  Matthias Klose  <doko@debian.org>

        2003-02-07  Richard Henderson  <rth@redhat.com>
        PR 9226
        * gcse.c (local_cprop_find_used_regs): New.
        (local_cprop_pass): Use it.

From-SVN: r63398

gcc/ChangeLog
gcc/gcse.c

index 8ca6665d171a0401450099ded428ee09f83a909b..2c59dd79a1ca8b65df4d5b20d77f0f3f6b3fd874 100644 (file)
@@ -1,3 +1,10 @@
+2003-02-25  Matthias Klose  <doko@debian.org>
+
+       2003-02-07  Richard Henderson  <rth@redhat.com>
+        PR 9226
+        * gcse.c (local_cprop_find_used_regs): New.
+        (local_cprop_pass): Use it.
+
 2003-02-25  Matthias Klose  <doko@debian.org>
 
        * config.gcc (m68k-*-linux*): Add crtbeginT.o to extra_parts.
index 8c6b87fbff9efaeb3c0af883f589d6c20f4e85f3..8150d51c00b658c5a5bec712ff98b38e9712b527 100644 (file)
@@ -700,6 +700,7 @@ static void store_motion            PARAMS ((void));
 static void free_insn_expr_list_list   PARAMS ((rtx *));
 static void clear_modify_mem_tables    PARAMS ((void));
 static void free_modify_mem_tables     PARAMS ((void));
+static void local_cprop_find_used_regs PARAMS ((rtx *, void *));
 \f
 /* Entry point for global common subexpression elimination.
    F is the first instruction in the function.  */
@@ -4165,13 +4166,13 @@ cprop_insn (bb, insn, alter_jumps)
     return 0;
 
   reg_use_count = 0;
-  note_uses (&PATTERN (insn), find_used_regs, NULL);
+  note_uses (&PATTERN (insn), local_cprop_find_used_regs, NULL);
   
   note = find_reg_equal_equiv_note (insn);
 
   /* We may win even when propagating constants into notes.  */
   if (note)
-    find_used_regs (&XEXP (note, 0), NULL);
+    local_cprop_find_used_regs (&XEXP (note, 0), NULL);
 
   for (reg_used = &reg_use_table[0]; reg_use_count > 0;
        reg_used++, reg_use_count--)
@@ -4281,6 +4282,54 @@ cprop_insn (bb, insn, alter_jumps)
   return changed;
 }
 
+/* Like find_used_regs, but avoid recording uses that appear in
+   input-output contexts such as zero_extract or pre_dec.  This
+   restricts the cases we consider to those for which local cprop
+   can legitimately make replacements.  */
+
+static void
+local_cprop_find_used_regs (xptr, data)
+     rtx *xptr;
+     void *data;
+{
+  rtx x = *xptr;
+
+  if (x == 0)
+    return;
+
+  switch (GET_CODE (x))
+    {
+    case ZERO_EXTRACT:
+    case SIGN_EXTRACT:
+    case STRICT_LOW_PART:
+      return;
+
+    case PRE_DEC:
+    case PRE_INC:
+    case POST_DEC:
+    case POST_INC:
+    case PRE_MODIFY:
+    case POST_MODIFY:
+      /* Can only legitimately appear this early in the context of
+       stack pushes for function arguments, but handle all of the
+       codes nonetheless.  */
+      return;
+
+    case SUBREG:
+      /* Setting a subreg of a register larger than word_mode leaves
+       the non-written words unchanged.  */
+      if (GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (x))) > BITS_PER_WORD)
+       return;
+      break;
+
+    default:
+      break;
+    }
+
+  find_used_regs (xptr, data);
+}
+
+
 /* Forward propagate copies.  This includes copies and constants.  Return
    non-zero if a change was made.  */