Patchwork Simplify ipcp_init_cloned_node

login
register
mail settings
Submitter Martin Jambor
Date June 28, 2010, 1:47 p.m.
Message ID <20100628134736.GC4383@virgil.arch.suse.de>
Download mbox | patch
Permalink /patch/57141/
State New
Headers show

Comments

Martin Jambor - June 28, 2010, 1:47 p.m.
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.
Jan Hubicka - June 28, 2010, 1:58 p.m.
> 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.

OK.
Honza

Patch

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;
 }