2005-01-16 Paolo Bonzini <bonzini@gnu.org>
authorbonzini <bonzini@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 16 Jan 2006 18:20:32 +0000 (18:20 +0000)
committerbonzini <bonzini@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 16 Jan 2006 18:20:32 +0000 (18:20 +0000)
* combine.c (record_value_for_reg): Invalidate registers
if INSN is null.
(record_dead_and_set_regs_1): Likewise, by passing them to
record_value_for_reg.
(record_dead_and_set_regs): Invalidate stores made by a
call.  We do not combine across a call, but we still
relied on equivalences.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@109759 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/combine.c

index 61e005c..057ad92 100644 (file)
@@ -1,3 +1,13 @@
+2005-01-16  Paolo Bonzini  <bonzini@gnu.org>
+
+       * combine.c (record_value_for_reg): Invalidate registers
+       if INSN is null.
+       (record_dead_and_set_regs_1): Likewise, by passing them to
+       record_value_for_reg.
+       (record_dead_and_set_regs): Invalidate stores made by a
+       call.  We do not combine across a call, but we still
+       relied on equivalences.
+
 2006-01-16  Eric Botcazou  <ebotcazou@adacore.com>
 
        * tree-vrp.c (extract_range_from_binary_expr): Cope with
index 16bb99c..69b9c10 100644 (file)
@@ -10927,7 +10927,7 @@ record_value_for_reg (rtx reg, rtx insn, rtx value)
   for (i = regno; i < endregno; i++)
     {
       reg_stat[i].last_set_label = label_tick;
-      if (value && reg_stat[i].last_set_table_tick == label_tick)
+      if (!insn || (value && reg_stat[i].last_set_table_tick == label_tick))
        reg_stat[i].last_set_invalid = 1;
       else
        reg_stat[i].last_set_invalid = 0;
@@ -10976,6 +10976,13 @@ record_dead_and_set_regs_1 (rtx dest, rtx setter, void *data)
   if (GET_CODE (dest) == SUBREG)
     dest = SUBREG_REG (dest);
 
+  if (!record_dead_insn)
+    {
+      if (REG_P (dest))
+       record_value_for_reg (dest, NULL_RTX, NULL_RTX);
+      return;
+    }
+
   if (REG_P (dest))
     {
       /* If we are setting the whole register, we know its value.  Otherwise
@@ -11049,15 +11056,14 @@ record_dead_and_set_regs (rtx insn)
 
       last_call_cuid = mem_last_set = INSN_CUID (insn);
 
-      /* Don't bother recording what this insn does.  It might set the
-        return value register, but we can't combine into a call
-        pattern anyway, so there's no point trying (and it may cause
-        a crash, if e.g. we wind up asking for last_set_value of a
-        SUBREG of the return value register).  */
-      return;
+      /* We can't combine into a call pattern.  Remember, though, that
+        the return value register is set at this CUID.  We could
+        still replace a register with the return value from the
+        wrong subroutine call!  */
+      note_stores (PATTERN (insn), record_dead_and_set_regs_1, NULL_RTX);
     }
-
-  note_stores (PATTERN (insn), record_dead_and_set_regs_1, insn);
+  else
+    note_stores (PATTERN (insn), record_dead_and_set_regs_1, insn);
 }
 
 /* If a SUBREG has the promoted bit set, it is in fact a property of the