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]

Re: [patch] tree-phinodes.c: Speed up remove_phi_arg_num.


Hi Jeff,

> > 	* tree-phinodes.c (remove_phi_arg_num): Do not zero the
> > 	element that's being removed.
> OK.  I would recommend a short comment indicating why it is safe to
> not clear the various structure elements.

Here is the final patch I committed.

Kazu Hirata

2004-11-02  Kazu Hirata  <kazu@cs.umass.edu>

	* tree-phinodes.c (remove_phi_arg_num): Do not zero the
	element that's being removed.

Index: tree-phinodes.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-phinodes.c,v
retrieving revision 2.15
diff -u -d -p -r2.15 tree-phinodes.c
--- tree-phinodes.c	30 Oct 2004 00:13:52 -0000	2.15
+++ tree-phinodes.c	2 Nov 2004 02:48:32 -0000
@@ -396,10 +396,10 @@ remove_phi_arg_num (tree phi, int i)
       PHI_ARG_NONZERO (phi, i) = PHI_ARG_NONZERO (phi, num_elem - 1);
     }
 
-  /* Shrink the vector and return.  */
-  SET_PHI_ARG_DEF (phi, num_elem - 1, NULL_TREE);
-  PHI_ARG_EDGE (phi, num_elem - 1) = NULL;
-  PHI_ARG_NONZERO (phi, num_elem - 1) = false;
+  /* Shrink the vector and return.  Note that we do not have to clear
+     PHI_ARG_DEF, PHI_ARG_EDGE, or PHI_ARG_NONZERO because the garbage
+     collector will not look at those elements beyond the first
+     PHI_NUM_ARGS elements of the array.  */
   PHI_NUM_ARGS (phi)--;
 }
 


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