Patchwork gcse.c ls_expr: remove 'loads field

login
register
mail settings
Submitter Steven Bosscher
Date May 1, 2011, 10:52 a.m.
Message ID <BANLkTimyzgeFF79g+zPmUjd4z8guCtUG1A@mail.gmail.com>
Download mbox | patch
Permalink /patch/93546/
State New
Headers show

Comments

Steven Bosscher - May 1, 2011, 10:52 a.m.
Hi,

I noticed that this field is write-only. The last use was for store
motion, which overloaded this 'loads' field with ANTIC_STORE_LIST. I
went back as far as gcc 3.3.6 but couldn't figure out what the field
is supposed to do for load motion. So this patch simply removes the
field.

Makes Nathan's EXPR_LIST/INSN_LIST a bit easier, too :-)

Bootstrapped&tested on x86_64-unknown-linux-gnu. OK for trunk?

Ciao!
Steven



	* gcse.c (struct ls_expr): Remove 'loads' member.
	(ldst_entry): Don't initialize it.
	(free_ldst_entry): Don't free it.
	(print_ldst_list): Don't dump it.
	(compute_ld_motion_mems): Don't allocate it.
Richard Guenther - May 2, 2011, 9:46 a.m.
On Sun, May 1, 2011 at 12:52 PM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
> Hi,
>
> I noticed that this field is write-only. The last use was for store
> motion, which overloaded this 'loads' field with ANTIC_STORE_LIST. I
> went back as far as gcc 3.3.6 but couldn't figure out what the field
> is supposed to do for load motion. So this patch simply removes the
> field.
>
> Makes Nathan's EXPR_LIST/INSN_LIST a bit easier, too :-)
>
> Bootstrapped&tested on x86_64-unknown-linux-gnu. OK for trunk?

Ok.

Thanks,
Richard.

> Ciao!
> Steven
>
>
>
>        * gcse.c (struct ls_expr): Remove 'loads' member.
>        (ldst_entry): Don't initialize it.
>        (free_ldst_entry): Don't free it.
>        (print_ldst_list): Don't dump it.
>        (compute_ld_motion_mems): Don't allocate it.
>
> Index: gcse.c
> ===================================================================
> --- gcse.c      (revision 173214)
> +++ gcse.c      (working copy)
> @@ -360,7 +360,6 @@ struct ls_expr
>   struct expr * expr;          /* Gcse expression reference for LM.  */
>   rtx pattern;                 /* Pattern of this mem.  */
>   rtx pattern_regs;            /* List of registers mentioned by the mem.  */
> -  rtx loads;                   /* INSN list of loads seen.  */
>   rtx stores;                  /* INSN list of stores seen.  */
>   struct ls_expr * next;       /* Next in the list.  */
>   int invalid;                 /* Invalid for some reason.  */
> @@ -3300,7 +3299,6 @@ ldst_entry (rtx x)
>   ptr->expr         = NULL;
>   ptr->pattern      = x;
>   ptr->pattern_regs = NULL_RTX;
> -  ptr->loads        = NULL_RTX;
>   ptr->stores       = NULL_RTX;
>   ptr->reaching_reg = NULL_RTX;
>   ptr->invalid      = 0;
> @@ -3317,7 +3315,6 @@ ldst_entry (rtx x)
>  static void
>  free_ldst_entry (struct ls_expr * ptr)
>  {
> -  free_INSN_LIST_list (& ptr->loads);
>   free_INSN_LIST_list (& ptr->stores);
>
>   free (ptr);
> @@ -3359,13 +3356,6 @@ print_ldst_list (FILE * file)
>
>       print_rtl (file, ptr->pattern);
>
> -      fprintf (file, "\n        Loads : ");
> -
> -      if (ptr->loads)
> -       print_rtl (file, ptr->loads);
> -      else
> -       fprintf (file, "(nil)");
> -
>       fprintf (file, "\n       Stores : ");
>
>       if (ptr->stores)
> @@ -3517,9 +3507,7 @@ compute_ld_motion_mems (void)
>                  if (MEM_P (src) && simple_mem (src))
>                    {
>                      ptr = ldst_entry (src);
> -                     if (REG_P (dest))
> -                       ptr->loads = alloc_INSN_LIST (insn, ptr->loads);
> -                     else
> +                     if (! REG_P (dest))
>                        ptr->invalid = 1;
>                    }
>                  else
>

Patch

Index: gcse.c
===================================================================
--- gcse.c	(revision 173214)
+++ gcse.c	(working copy)
@@ -360,7 +360,6 @@  struct ls_expr
   struct expr * expr;		/* Gcse expression reference for LM.  */
   rtx pattern;			/* Pattern of this mem.  */
   rtx pattern_regs;		/* List of registers mentioned by the mem.  */
-  rtx loads;			/* INSN list of loads seen.  */
   rtx stores;			/* INSN list of stores seen.  */
   struct ls_expr * next;	/* Next in the list.  */
   int invalid;			/* Invalid for some reason.  */
@@ -3300,7 +3299,6 @@  ldst_entry (rtx x)
   ptr->expr         = NULL;
   ptr->pattern      = x;
   ptr->pattern_regs = NULL_RTX;
-  ptr->loads        = NULL_RTX;
   ptr->stores       = NULL_RTX;
   ptr->reaching_reg = NULL_RTX;
   ptr->invalid      = 0;
@@ -3317,7 +3315,6 @@  ldst_entry (rtx x)
 static void
 free_ldst_entry (struct ls_expr * ptr)
 {
-  free_INSN_LIST_list (& ptr->loads);
   free_INSN_LIST_list (& ptr->stores);

   free (ptr);
@@ -3359,13 +3356,6 @@  print_ldst_list (FILE * file)

       print_rtl (file, ptr->pattern);

-      fprintf (file, "\n	 Loads : ");
-
-      if (ptr->loads)
-	print_rtl (file, ptr->loads);
-      else
-	fprintf (file, "(nil)");
-
       fprintf (file, "\n	Stores : ");

       if (ptr->stores)
@@ -3517,9 +3507,7 @@  compute_ld_motion_mems (void)
 		  if (MEM_P (src) && simple_mem (src))
 		    {
 		      ptr = ldst_entry (src);
-		      if (REG_P (dest))
-			ptr->loads = alloc_INSN_LIST (insn, ptr->loads);
-		      else
+		      if (! REG_P (dest))
 			ptr->invalid = 1;
 		    }
 		  else