public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* regrename: don't update REG_DEAD notes
@ 2011-06-16 14:39 Bernd Schmidt
  2011-06-16 15:20 ` Richard Henderson
  2011-06-16 15:40 ` Hans-Peter Nilsson
  0 siblings, 2 replies; 5+ messages in thread
From: Bernd Schmidt @ 2011-06-16 14:39 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 682 bytes --]

We're updating REG_DEAD notes in regrename.c, but it seems this is for
historical reasons only. As far as I can tell, every pass that needs
such notes recomputes them with df_note_add_problem/df_analyze, and the
following patch bootstrapped and tested successfully on i686-linux (some
random libmudflap failures mentioned previously), with the following
change to ensure it's tested:

+++ gcc/config/i386/i386.c	(working copy)
@@ -5099,6 +5099,9 @@ static const struct default_options ix86
 #ifdef INSN_SCHEDULING
     { OPT_LEVELS_ALL, OPT_fschedule_insns, NULL, 0 },
 #endif
+#ifdef INSN_SCHEDULING
+    { OPT_LEVELS_2_PLUS, OPT_frename_registers, NULL, 1 },
+#endif

Ok?


Bernd

[-- Attachment #2: rrnotes.diff --]
[-- Type: text/plain, Size: 1732 bytes --]

	* regrename.c (do_replace): Don't update notes.

Index: gcc/regrename.c
===================================================================
--- gcc/regrename.c	(revision 174842)
+++ gcc/regrename.c	(working copy)
@@ -432,7 +432,6 @@ do_replace (struct du_head *head, int re
 {
   struct du_chain *chain;
   unsigned int base_regno = head->regno;
-  bool found_note = false;
 
   gcc_assert (! DEBUG_INSN_P (head->first->insn));
 
@@ -446,46 +445,15 @@ do_replace (struct du_head *head, int re
 	INSN_VAR_LOCATION_LOC (chain->insn) = gen_rtx_UNKNOWN_VAR_LOC ();
       else
 	{
-	  rtx note;
-
 	  *chain->loc = gen_raw_REG (GET_MODE (*chain->loc), reg);
 	  if (regno >= FIRST_PSEUDO_REGISTER)
 	    ORIGINAL_REGNO (*chain->loc) = regno;
 	  REG_ATTRS (*chain->loc) = attr;
 	  REG_POINTER (*chain->loc) = reg_ptr;
-
-	  for (note = REG_NOTES (chain->insn); note; note = XEXP (note, 1))
-	    {
-	      enum reg_note kind = REG_NOTE_KIND (note);
-	      if (kind == REG_DEAD || kind == REG_UNUSED)
-		{
-		  rtx reg = XEXP (note, 0);
-		  gcc_assert (HARD_REGISTER_P (reg));
-
-		  if (REGNO (reg) == base_regno)
-		    {
-		      found_note = true;
-		      if (kind == REG_DEAD
-			  && reg_set_p (*chain->loc, chain->insn))
-			remove_note (chain->insn, note);
-		      else
-			XEXP (note, 0) = *chain->loc;
-		      break;
-		    }
-		}
-	    }
 	}
 
       df_insn_rescan (chain->insn);
     }
-  if (!found_note)
-    {
-      /* If the chain's first insn is the same as the last, we should have
-	 found a REG_UNUSED note.  */
-      gcc_assert (head->first->insn != head->last->insn);
-      if (!reg_set_p (*head->last->loc, head->last->insn))
-	add_reg_note (head->last->insn, REG_DEAD, *head->last->loc);
-    }
 }
 
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: regrename: don't update REG_DEAD notes
  2011-06-16 14:39 regrename: don't update REG_DEAD notes Bernd Schmidt
@ 2011-06-16 15:20 ` Richard Henderson
  2011-06-16 15:40 ` Hans-Peter Nilsson
  1 sibling, 0 replies; 5+ messages in thread
From: Richard Henderson @ 2011-06-16 15:20 UTC (permalink / raw)
  To: Bernd Schmidt; +Cc: GCC Patches

On 06/16/2011 07:33 AM, Bernd Schmidt wrote:
> 	* regrename.c (do_replace): Don't update notes.

Ok.


r~

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: regrename: don't update REG_DEAD notes
  2011-06-16 14:39 regrename: don't update REG_DEAD notes Bernd Schmidt
  2011-06-16 15:20 ` Richard Henderson
@ 2011-06-16 15:40 ` Hans-Peter Nilsson
  2011-06-16 15:45   ` Bernd Schmidt
  2011-06-16 16:14   ` Richard Henderson
  1 sibling, 2 replies; 5+ messages in thread
From: Hans-Peter Nilsson @ 2011-06-16 15:40 UTC (permalink / raw)
  To: Bernd Schmidt; +Cc: GCC Patches

On Thu, 16 Jun 2011, Bernd Schmidt wrote:
> We're updating REG_DEAD notes in regrename.c, but it seems this is for
> historical reasons only. As far as I can tell, every pass that needs
> such notes recomputes them with df_note_add_problem/df_analyze, and the
> following patch bootstrapped and tested successfully on i686-linux (some
> random libmudflap failures mentioned previously), with the following
> change to ensure it's tested:
>
> +++ gcc/config/i386/i386.c	(working copy)

(Not a dbr target...)

> Ok?

NO!  They're still used by reorg.c+resource.c

brgds, H-P

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: regrename: don't update REG_DEAD notes
  2011-06-16 15:40 ` Hans-Peter Nilsson
@ 2011-06-16 15:45   ` Bernd Schmidt
  2011-06-16 16:14   ` Richard Henderson
  1 sibling, 0 replies; 5+ messages in thread
From: Bernd Schmidt @ 2011-06-16 15:45 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: GCC Patches

On 06/16/2011 05:25 PM, Hans-Peter Nilsson wrote:
> On Thu, 16 Jun 2011, Bernd Schmidt wrote:
>> We're updating REG_DEAD notes in regrename.c, but it seems this is for
>> historical reasons only. As far as I can tell, every pass that needs
>> such notes recomputes them with df_note_add_problem/df_analyze, and the
>> following patch bootstrapped and tested successfully on i686-linux (some
>> random libmudflap failures mentioned previously), with the following
>> change to ensure it's tested:
>>
>> +++ gcc/config/i386/i386.c	(working copy)
> 
> (Not a dbr target...)
> 
>> Ok?
> 
> NO!  They're still used by reorg.c+resource.c

Well, that's reorg's problem. In between regrename and reorg.c, we have
a number of opportunities, such as pass_sched2, which use

  df_set_flags (DF_LR_RUN_DCE);
  df_note_add_problem ();

to recompute notes. If reorg.c wants accurate notes it should do the
same, especially since the scheduler (and presumably several other
passes) already makes no effort to update such notes. It seems this was
removed with the df merge:

        * sched-rgn.c (check_dead_notes1, deaths_in_region): Removed.
        (init_regions, add_block1): Removed last of note counting code.


Bernd

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: regrename: don't update REG_DEAD notes
  2011-06-16 15:40 ` Hans-Peter Nilsson
  2011-06-16 15:45   ` Bernd Schmidt
@ 2011-06-16 16:14   ` Richard Henderson
  1 sibling, 0 replies; 5+ messages in thread
From: Richard Henderson @ 2011-06-16 16:14 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: Bernd Schmidt, GCC Patches

On 06/16/2011 08:25 AM, Hans-Peter Nilsson wrote:
>> +++ gcc/config/i386/i386.c	(working copy)
> 
> (Not a dbr target...)
> 
>> Ok?
> 
> NO!  They're still used by reorg.c+resource.c

Already handled:

rest_of_pass_free_cfg (void)
{
#ifdef DELAY_SLOTS
  /* The resource.c machinery uses DF but the CFG isn't guaranteed to be
     valid at that point so it would be too late to call df_analyze.  */
  if (optimize > 0 && flag_delayed_branch)
    {
      df_note_add_problem ();
      df_analyze ();
    }
#endif



r~

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-06-16 15:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-16 14:39 regrename: don't update REG_DEAD notes Bernd Schmidt
2011-06-16 15:20 ` Richard Henderson
2011-06-16 15:40 ` Hans-Peter Nilsson
2011-06-16 15:45   ` Bernd Schmidt
2011-06-16 16:14   ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).