This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Remove useless code in cselib


On Tue, Apr 06, 2004 at 12:55:28PM -0400, Jakub Jelinek wrote:
> Hi!
> 
> http://gcc.gnu.org/ml/gcc-patches/2004-01/msg00963.html
> patch (trunk, gcc-3_4-branch) introduced canon_loc field in
> struct elt_loc_list and canon_x var in cselib_invalidate_mem.
> But:
> find . -name \*.[chS] | xargs grep canon_'\(x\|loc\)'
> ./cselib.h:  rtx canon_loc;
> ./cselib.c:  el->canon_loc = NULL;
> ./cselib.c:       rtx canon_x = (*p)->canon_loc;
> ./cselib.c:       if (!canon_x)
> ./cselib.c:         canon_x = (*p)->canon_loc = canon_rtx (x);
> 
> So unless canon_rtx actually modifies its argument (AFAIK it should not),
> this is all useless code wasting cycles.
> Either these 5 lines should be yanked, or canon_x should be actually
> used somewhere (I'm not sure if canon_true_dependence needs also x
> canonicalized or not).

It seems x is always (mem (value:Pmode)) at this place and canon_rtx
doesn't change that at all (canon_rtx on VALUE returns that VALUE
immediately and on MEM it does returns
replace_equiv_address_nv (x, canon_rtx (XEXP (x, 0)));
which is again x because XEXP (x, 0) did not change.

So, ok to commit this?
For 3.4.1 as well?

2004-04-06  Jakub Jelinek  <jakub@redhat.com>

	* cselib.h (struct elt_loc_list): Remove canon_loc field.
	* cselib.c (new_elt_loc_list): Remove canon_loc initialization.
	(cselib_invalidate_mem): Remove all canon_loc and canon_x
	traces.

--- gcc/cselib.c.jj	2004-03-09 16:08:55.000000000 +0100
+++ gcc/cselib.c	2004-04-06 23:27:32.980109237 +0200
@@ -157,7 +157,6 @@ new_elt_loc_list (struct elt_loc_list *n
   el = pool_alloc (elt_loc_list_pool);
   el->next = next;
   el->loc = loc;
-  el->canon_loc = NULL;
   el->setting_insn = cselib_current_insn;
   el->in_libcall = cselib_current_insn_in_libcall;
   return el;
@@ -1081,7 +1080,6 @@ cselib_invalidate_mem (rtx mem_rtx)
       while (*p)
 	{
 	  rtx x = (*p)->loc;
-	  rtx canon_x = (*p)->canon_loc;
 	  cselib_val *addr;
 	  struct elt_list **mem_chain;
 
@@ -1092,8 +1090,6 @@ cselib_invalidate_mem (rtx mem_rtx)
 	      p = &(*p)->next;
 	      continue;
 	    }
-	  if (!canon_x)
-	    canon_x = (*p)->canon_loc = canon_rtx (x);
 	  if (num_mems < PARAM_VALUE (PARAM_MAX_CSELIB_MEMORY_LOCATIONS)
 	      && ! canon_true_dependence (mem_rtx, GET_MODE (mem_rtx), mem_addr,
 		      			  x, cselib_rtx_varies_p))
--- gcc/cselib.h.jj	2004-04-03 20:25:52.000000000 +0200
+++ gcc/cselib.h	2004-04-06 23:27:15.113311200 +0200
@@ -49,7 +49,6 @@ struct elt_loc_list GTY(())
   struct elt_loc_list *next;
   /* An rtl expression that holds the value.  */
   rtx loc;
-  rtx canon_loc;
   /* The insn that made the equivalence.  */
   rtx setting_insn;
   /* True when setting insn is inside libcall.  */


	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]