re PR debug/53740 (--enable-checking=yes,rtl bootstrap failure with ada)
authorRichard Sandiford <rdsandiford@googlemail.com>
Mon, 25 Jun 2012 13:25:39 +0000 (13:25 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Mon, 25 Jun 2012 13:25:39 +0000 (13:25 +0000)
gcc/
PR debug/53740
* df.h (dead_debug_add): Remove third argument.
* df-problems.c (dead_debug_add): Likewise.  Use the REGNO of the
REG that we want to replace instead.
(dead_debug_insert_temp): Use the REGNO of the reg that we want
to replace instead of DF_REF_REGNO.  Require there to always be
at least one such use.  Check for cases where the same location
has more than df_ref associated with it.
(df_note_bb_compute): Remove third dead_debug_add argument.
* dce.c (word_dce_process_block): Likewise.

From-SVN: r188934

gcc/ChangeLog
gcc/dce.c
gcc/df-problems.c
gcc/df.h

index 97280220f2e3ded118af7f98e389b17b536ea9f7..8ccdaf02d31e33ca55db9c5eed20dd44035d8d49 100644 (file)
@@ -1,3 +1,16 @@
+2012-06-25  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       PR debug/53740
+       * df.h (dead_debug_add): Remove third argument.
+       * df-problems.c (dead_debug_add): Likewise.  Use the REGNO of the
+       REG that we want to replace instead.
+       (dead_debug_insert_temp): Use the REGNO of the reg that we want
+       to replace instead of DF_REF_REGNO.  Require there to always be
+       at least one such use.  Check for cases where the same location
+       has more than df_ref associated with it.
+       (df_note_bb_compute): Remove third dead_debug_add argument.
+       * dce.c (word_dce_process_block): Likewise.
+
 2012-06-25  Steven Bosscher  <steven@gcc.gnu.org>
 
        * config/v850/v850.c: Remove redundant extern declarations for
index 8954d5c0c01fd188eee894606c11d53f286f1201..7e522c19a82b1f7ea5297247e0088134d6b8f40e 100644 (file)
--- a/gcc/dce.c
+++ b/gcc/dce.c
@@ -848,7 +848,7 @@ word_dce_process_block (basic_block bb, bool redo_out)
                  == 2 * UNITS_PER_WORD)
              && !bitmap_bit_p (local_live, 2 * DF_REF_REGNO (*use_rec))
              && !bitmap_bit_p (local_live, 2 * DF_REF_REGNO (*use_rec) + 1))
-           dead_debug_add (&debug, *use_rec, DF_REF_REGNO (*use_rec));
+           dead_debug_add (&debug, *use_rec);
       }
     else if (INSN_P (insn))
       {
@@ -938,7 +938,7 @@ dce_process_block (basic_block bb, bool redo_out, bitmap au)
        for (use_rec = DF_INSN_USES (insn); *use_rec; use_rec++)
          if (!bitmap_bit_p (local_live, DF_REF_REGNO (*use_rec))
              && !bitmap_bit_p (au, DF_REF_REGNO (*use_rec)))
-           dead_debug_add (&debug, *use_rec, DF_REF_REGNO (*use_rec));
+           dead_debug_add (&debug, *use_rec);
       }
     else if (INSN_P (insn))
       {
index a020e28ad2756cda21b4917d9982f11da4f0ae5b..2a698d4d5e2f17908368b8e7af3f1d18f488d8b6 100644 (file)
@@ -3165,10 +3165,10 @@ dead_debug_finish (struct dead_debug *debug, bitmap used)
     }
 }
 
-/* Add USE to DEBUG.  It must be a dead reference to UREGNO in a debug
+/* Add USE to DEBUG.  It must be a dead reference to a register in a debug
    insn.  Create a bitmap for DEBUG as needed.  */
 void
-dead_debug_add (struct dead_debug *debug, df_ref use, unsigned int uregno)
+dead_debug_add (struct dead_debug *debug, df_ref use)
 {
   struct dead_debug_use *newddu = XNEW (struct dead_debug_use);
 
@@ -3179,7 +3179,7 @@ dead_debug_add (struct dead_debug *debug, df_ref use, unsigned int uregno)
   if (!debug->used)
     debug->used = BITMAP_ALLOC (NULL);
 
-  bitmap_set_bit (debug->used, uregno);
+  bitmap_set_bit (debug->used, REGNO (*DF_REF_REAL_LOC (use)));
 }
 
 /* If UREGNO is referenced by any entry in DEBUG, emit a debug insn
@@ -3201,6 +3201,7 @@ dead_debug_insert_temp (struct dead_debug *debug, unsigned int uregno,
   rtx breg;
   rtx dval;
   rtx bind;
+  rtx cur_reg;
 
   if (!debug->used || !bitmap_clear_bit (debug->used, uregno))
     return 0;
@@ -3209,7 +3210,8 @@ dead_debug_insert_temp (struct dead_debug *debug, unsigned int uregno,
      the widest referenced mode.  */
   while ((cur = *tailp))
     {
-      if (DF_REF_REGNO (cur->use) == uregno)
+      cur_reg = *DF_REF_REAL_LOC (cur->use);
+      if (REGNO (cur_reg) == uregno)
        {
          *usesp = cur;
          usesp = &cur->next;
@@ -3217,21 +3219,13 @@ dead_debug_insert_temp (struct dead_debug *debug, unsigned int uregno,
          cur->next = NULL;
          if (!reg
              || (GET_MODE_BITSIZE (GET_MODE (reg))
-                 < GET_MODE_BITSIZE (GET_MODE (*DF_REF_REAL_LOC (cur->use)))))
-           reg = *DF_REF_REAL_LOC (cur->use);
+                 < GET_MODE_BITSIZE (GET_MODE (cur_reg))))
+           reg = cur_reg;
        }
       else
        tailp = &(*tailp)->next;
     }
 
-  /* We may have dangling bits in debug->used for registers that were part
-     of a multi-register use, one component of which has been reset.  */
-  if (reg == NULL)
-    {
-      gcc_checking_assert (!uses);
-      return 0;
-    }
-
   gcc_checking_assert (uses);
 
   breg = reg;
@@ -3340,15 +3334,21 @@ dead_debug_insert_temp (struct dead_debug *debug, unsigned int uregno,
   /* Adjust all uses.  */
   while ((cur = uses))
     {
-      if (GET_MODE (*DF_REF_REAL_LOC (cur->use)) == GET_MODE (reg))
-       *DF_REF_REAL_LOC (cur->use) = dval;
-      else
-       *DF_REF_REAL_LOC (cur->use)
-         = gen_lowpart_SUBREG (GET_MODE (*DF_REF_REAL_LOC (cur->use)), dval);
-      /* ??? Should we simplify subreg of subreg?  */
-      if (debug->to_rescan == NULL)
-       debug->to_rescan = BITMAP_ALLOC (NULL);
-      bitmap_set_bit (debug->to_rescan, INSN_UID (DF_REF_INSN (cur->use)));
+      /* If the reference spans multiple hard registers, we'll have
+        a use for each one.  Only change each reference once.  */
+      cur_reg = *DF_REF_REAL_LOC (cur->use);
+      if (REG_P (cur_reg))
+       {
+         if (GET_MODE (cur_reg) == GET_MODE (reg))
+           *DF_REF_REAL_LOC (cur->use) = dval;
+         else
+           *DF_REF_REAL_LOC (cur->use)
+             = gen_lowpart_SUBREG (GET_MODE (cur_reg), dval);
+         /* ??? Should we simplify subreg of subreg?  */
+         if (debug->to_rescan == NULL)
+           debug->to_rescan = BITMAP_ALLOC (NULL);
+         bitmap_set_bit (debug->to_rescan, INSN_UID (DF_REF_INSN (cur->use)));
+        }
       uses = cur->next;
       XDELETE (cur);
     }
@@ -3547,7 +3547,7 @@ df_note_bb_compute (unsigned int bb_index,
                         debug insns either.  */
                      if (!bitmap_bit_p (artificial_uses, uregno)
                          && !df_ignore_stack_reg (uregno))
-                       dead_debug_add (&debug, use, uregno);
+                       dead_debug_add (&debug, use);
                      continue;
                    }
                  break;
index 1b4882d1d167e08764f3409a5d9a91599afa1575..b6d168d8ee92e756431f1fc5c01b4a719ae37f9e 100644 (file)
--- a/gcc/df.h
+++ b/gcc/df.h
@@ -1138,7 +1138,7 @@ enum debug_temp_where
 
 extern void dead_debug_init (struct dead_debug *, bitmap);
 extern void dead_debug_finish (struct dead_debug *, bitmap);
-extern void dead_debug_add (struct dead_debug *, df_ref, unsigned int);
+extern void dead_debug_add (struct dead_debug *, df_ref);
 extern int dead_debug_insert_temp (struct dead_debug *,
                                   unsigned int uregno, rtx insn,
                                   enum debug_temp_where);