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] Simplify ipcp_init_cloned_node


Hi,

when I was going through the IPA-CP analysis code again I noticed that
ipcp_init_cloned_node was calling some initialization functions that
have already been done by node duplication hook (and the
initialization functions then do nothing because they check whether
the data structures they allocate already exist).  The following patch
therefore replaces them with an assert.  I decided that checking
assert would do because if the condition is false, we would most most
probably run into a segfaut later.

Bootstrapped and tested on x86_64-linux without any issues.  OK for
trunk?

Thanks,

Martin

2010-06-27  Martin Jambor  <mjambor@suse.cz>

	* ipa-cp.c (ipcp_init_cloned_node): Replace calls to
	ipa_check_create_node_params and ipa_initialize_node_params with
	checking asserts they are not necessary.

Index: icln/gcc/ipa-cp.c
===================================================================
--- icln.orig/gcc/ipa-cp.c
+++ icln/gcc/ipa-cp.c
@@ -172,8 +172,11 @@ static void
 ipcp_init_cloned_node (struct cgraph_node *orig_node,
 		       struct cgraph_node *new_node)
 {
-  ipa_check_create_node_params ();
-  ipa_initialize_node_params (new_node);
+  gcc_checking_assert (ipa_node_params_vector
+		       && (VEC_length (ipa_node_params_t,
+				       ipa_node_params_vector)
+			   > (unsigned) cgraph_max_uid));
+  gcc_checking_assert (IPA_NODE_REF (new_node)->params);
   IPA_NODE_REF (new_node)->ipcp_orig_node = orig_node;
 }
 


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