public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Martin Liška" <mliska@suse.cz>
To: gcc-patches@gcc.gnu.org
Cc: hubicka@ucw.cz
Subject: Re: [PATCH 2/5] Existing call graph infrastructure enhancement
Date: Wed, 24 Sep 2014 14:23:00 -0000	[thread overview]
Message-ID: <5422D3F1.7000909@suse.cz> (raw)
In-Reply-To: <47303faf697c5f537d471e88d3c946c5a1d04f6e.1402913001.git.mliska@suse.cz>

[-- Attachment #1: Type: text/plain, Size: 4389 bytes --]

On 06/13/2014 12:26 PM, mliska wrote:
> Hi,
>      this small patch prepares remaining needed infrastructure for the new pass.
>
> Changelog:
>
> 2014-06-13  Martin Liska  <mliska@suse.cz>
> 	    Honza Hubicka  <hubicka@ucw.cz>
>
> 	* ipa-utils.h (polymorphic_type_binfo_p): Function marked external
> 	instead of static.
> 	* ipa-devirt.c (polymorphic_type_binfo_p): Likewise.
> 	* ipa-prop.h (count_formal_params): Likewise.
> 	* ipa-prop.c (count_formal_params): Likewise.
> 	* ipa-utils.c (ipa_merge_profiles): Be more tolerant if we merge
> 	profiles for semantically equivalent functions.
> 	* passes.c (do_per_function): If we load body of a function during WPA,
> 	this condition should behave same.
> 	* varpool.c (ctor_for_folding): More tolerant assert for variable
> 	aliases created during WPA.
>
> diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
> index d733461..18592d7 100644
> --- a/gcc/ipa-devirt.c
> +++ b/gcc/ipa-devirt.c
> @@ -176,7 +176,7 @@ struct GTY(()) odr_type_d
>      inheritance (because vtables are shared).  Look up the BINFO of type
>      and check presence of its vtable.  */
>
> -static inline bool
> +bool
>   polymorphic_type_binfo_p (tree binfo)
>   {
>     /* See if BINFO's type has an virtual table associtated with it.  */
> diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
> index b67deed..60bda71 100644
> --- a/gcc/ipa-prop.c
> +++ b/gcc/ipa-prop.c
> @@ -210,7 +210,7 @@ ipa_populate_param_decls (struct cgraph_node *node,
>
>   /* Return how many formal parameters FNDECL has.  */
>
> -static inline int
> +int
>   count_formal_params (tree fndecl)
>   {
>     tree parm;
> diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h
> index cb23698..87573ff 100644
> --- a/gcc/ipa-prop.h
> +++ b/gcc/ipa-prop.h
> @@ -529,6 +529,7 @@ void ipa_free_all_edge_args (void);
>   void ipa_free_all_structures_after_ipa_cp (void);
>   void ipa_free_all_structures_after_iinln (void);
>   void ipa_register_cgraph_hooks (void);
> +int count_formal_params (tree fndecl);
>
>   /* This function ensures the array of node param infos is big enough to
>      accommodate a structure for all nodes and reallocates it if not.  */
> diff --git a/gcc/ipa-utils.c b/gcc/ipa-utils.c
> index 8e7c7cb..bc2b958 100644
> --- a/gcc/ipa-utils.c
> +++ b/gcc/ipa-utils.c
> @@ -660,13 +660,8 @@ ipa_merge_profiles (struct cgraph_node *dst,
>     if (dst->tp_first_run > src->tp_first_run && src->tp_first_run)
>       dst->tp_first_run = src->tp_first_run;
>
> -  if (src->profile_id)
> -    {
> -      if (!dst->profile_id)
> -	dst->profile_id = src->profile_id;
> -      else
> -	gcc_assert (src->profile_id == dst->profile_id);
> -    }
> +  if (src->profile_id && !dst->profile_id)
> +    dst->profile_id = src->profile_id;
>
>     if (!dst->count)
>       return;
> diff --git a/gcc/ipa-utils.h b/gcc/ipa-utils.h
> index a2c985a..996249a 100644
> --- a/gcc/ipa-utils.h
> +++ b/gcc/ipa-utils.h
> @@ -72,6 +72,8 @@ struct odr_type_d;
>   typedef odr_type_d *odr_type;
>   void build_type_inheritance_graph (void);
>   void update_type_inheritance_graph (void);
> +bool polymorphic_type_binfo_p (tree binfo);
> +
>   vec <cgraph_node *>
>   possible_polymorphic_call_targets (tree, HOST_WIDE_INT,
>   				   ipa_polymorphic_call_context,
> diff --git a/gcc/passes.c b/gcc/passes.c
> index 4366251..9fdfe51 100644
> --- a/gcc/passes.c
> +++ b/gcc/passes.c
> @@ -1506,7 +1506,7 @@ do_per_function (void (*callback) (function *, void *data), void *data)
>       {
>         struct cgraph_node *node;
>         FOR_EACH_DEFINED_FUNCTION (node)
> -	if (node->analyzed && gimple_has_body_p (node->decl)
> +	if (node->analyzed && (gimple_has_body_p (node->decl) && !in_lto_p)
>   	    && (!node->clone_of || node->decl != node->clone_of->decl))
>   	  callback (DECL_STRUCT_FUNCTION (node->decl), data);
>       }
> diff --git a/gcc/varpool.c b/gcc/varpool.c
> index ff67127..5cc558e 100644
> --- a/gcc/varpool.c
> +++ b/gcc/varpool.c
> @@ -293,6 +293,7 @@ ctor_for_folding (tree decl)
>     if (decl != real_decl)
>       {
>         gcc_assert (!DECL_INITIAL (decl)
> +		  || (node->alias && varpool_alias_target (node) == real_node)
>   		  || DECL_INITIAL (decl) == error_mark_node);
>         if (lookup_attribute ("weakref", DECL_ATTRIBUTES (decl)))
>   	{
>

Hi.

Following patch enhances API functions to be ready for main patch of this patchset.

Ready for thunk?

Thank you,
Martin

[-- Attachment #2: ipa-icf-api-enhancement.changelog --]
[-- Type: text/plain, Size: 447 bytes --]

gcc/ChangeLog:

2014-09-21  Martin Liška  <mliska@suse.cz>

	* cgraph.c (cgraph_node::release_body): New argument keep_arguments
	introduced.
	* cgraph.h: Likewise.
	* cgraphunit.c (cgraph_node::create_wrapper): Usage of new argument introduced.
	* ipa-devirt.c (polymorphic_type_binfo_p): Safe check for binfos created by Java.
	* tree-ssa-alias.c (ao_ref_base_alias_set): Static function transformed to global.
	* tree-ssa-alias.h: Likewise.

[-- Attachment #3: ipa-icf-api-enhancement.patch --]
[-- Type: text/x-patch, Size: 3036 bytes --]

diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 8f04284..d40a2922 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -1637,13 +1637,15 @@ release_function_body (tree decl)
    are free'd in final.c via free_after_compilation().  */
 
 void
-cgraph_node::release_body (void)
+cgraph_node::release_body (bool keep_arguments)
 {
   ipa_transforms_to_apply.release ();
   if (!used_as_abstract_origin && symtab->state != PARSING)
     {
       DECL_RESULT (decl) = NULL;
-      DECL_ARGUMENTS (decl) = NULL;
+
+      if (!keep_arguments)
+	DECL_ARGUMENTS (decl) = NULL;
     }
   /* If the node is abstract and needed, then do not clear DECL_INITIAL
      of its associated function function declaration because it's
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index a316e40..19ce3b8 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -915,7 +915,7 @@ public:
      Use this only for functions that are released before being translated to
      target code (i.e. RTL).  Functions that are compiled to RTL and beyond
      are free'd in final.c via free_after_compilation().  */
-  void release_body (void);
+  void release_body (bool keep_arguments = false);
 
   /* cgraph_node is no longer nested function; update cgraph accordingly.  */
   void unnest (void);
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 3e3b8d2..c4597e2 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -2300,7 +2300,7 @@ cgraph_node::create_wrapper (cgraph_node *target)
     tree decl_result = DECL_RESULT (decl);
 
     /* Remove the function's body.  */
-    release_body ();
+    release_body (true);
     reset ();
 
     DECL_RESULT (decl) = decl_result;
diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
index af42c6d..f374933 100644
--- a/gcc/ipa-devirt.c
+++ b/gcc/ipa-devirt.c
@@ -225,7 +225,7 @@ static inline bool
 polymorphic_type_binfo_p (tree binfo)
 {
   /* See if BINFO's type has an virtual table associtated with it.  */
-  return BINFO_VTABLE (TYPE_BINFO (BINFO_TYPE (binfo)));
+  return BINFO_TYPE (binfo) && BINFO_VTABLE (TYPE_BINFO (BINFO_TYPE (binfo)));
 }
 
 /* Return TRUE if all derived types of T are known and thus
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index 442112a..1bf88e2 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -559,7 +559,7 @@ ao_ref_base (ao_ref *ref)
 
 /* Returns the base object alias set of the memory reference *REF.  */
 
-static alias_set_type
+alias_set_type
 ao_ref_base_alias_set (ao_ref *ref)
 {
   tree base_ref;
diff --git a/gcc/tree-ssa-alias.h b/gcc/tree-ssa-alias.h
index 436381a..0d35283 100644
--- a/gcc/tree-ssa-alias.h
+++ b/gcc/tree-ssa-alias.h
@@ -98,6 +98,7 @@ extern void ao_ref_init (ao_ref *, tree);
 extern void ao_ref_init_from_ptr_and_size (ao_ref *, tree, tree);
 extern tree ao_ref_base (ao_ref *);
 extern alias_set_type ao_ref_alias_set (ao_ref *);
+extern alias_set_type ao_ref_base_alias_set (ao_ref *);
 extern bool ptr_deref_may_alias_global_p (tree);
 extern bool ptr_derefs_may_alias_p (tree, tree);
 extern bool ref_may_alias_global_p (tree);

  parent reply	other threads:[~2014-09-24 14:23 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-16 10:07 [PATCH 1/5] New Identical Code Folding IPA pass mliska
2014-06-16 10:07 ` [PATCH 5/5] New tests introduction mliska
2014-06-17 19:53   ` Jeff Law
2014-06-30 12:14     ` Martin Liška
2014-10-19  8:19       ` Andreas Schwab
2014-10-23 12:34         ` Martin Liška
2014-06-16 10:07 ` [PATCH 2/5] Existing call graph infrastructure enhancement mliska
2014-06-17 20:00   ` Jeff Law
2014-06-30 11:49     ` Martin Liška
2014-06-30 18:54       ` Jeff Law
2014-07-17 14:54         ` Martin Liška
2014-08-25  9:56           ` Martin Liška
2014-08-25 16:12             ` Jan Hubicka
2014-08-27 21:12             ` Jeff Law
2014-09-24 14:23   ` Martin Liška [this message]
2014-09-24 15:01     ` Jan Hubicka
2014-09-26 10:19       ` Martin Liška
2014-06-16 10:07 ` [PATCH 3/5] IPA ICF pass mliska
2014-06-20  7:32   ` Trevor Saunders
2014-06-26 11:18     ` Martin Liška
2014-07-05 21:44     ` Gerald Pfeifer
2014-07-05 22:53       ` Jan Hubicka
2014-07-17 15:23         ` Martin Liška
2014-09-26 12:20           ` Martin Liška
2014-09-26 14:44             ` Markus Trippelsdorf
2014-09-26 23:27               ` Jan Hubicka
2014-09-27  5:59                 ` Markus Trippelsdorf
2014-09-27  7:47                   ` Markus Trippelsdorf
2014-09-27 10:46                     ` Martin Liška
2014-09-27 10:37                   ` Martin Liška
2014-09-28  2:21                     ` Jan Hubicka
2014-10-10 23:54                       ` Fakturace
2014-10-11  0:02                       ` Martin Liška
2014-10-11  8:23                         ` Jan Hubicka
2014-10-13 13:20                           ` Martin Liška
2014-10-13 13:29                             ` Jan Hubicka
2014-09-27 10:32                 ` Martin Liška
2014-09-26 20:47             ` Jan Hubicka
2014-10-11  0:08               ` Martin Liška
2014-10-11  8:26                 ` Jan Hubicka
2014-10-13 15:17                 ` Martin Liška
2014-10-14 16:12                   ` Jan Hubicka
2014-10-15 17:06                     ` Martin Liška
2014-10-22 21:20                       ` Jiong Wang
2014-11-06  3:01                         ` Joey Ye
2014-11-06  9:03                           ` Jan Hubicka
2014-11-13 22:26                       ` H.J. Lu
2015-01-20 21:29                         ` H.J. Lu
2014-09-26 22:27             ` Jan Hubicka
2014-10-11  0:23               ` Martin Liška
2014-10-11  9:05                 ` Jan Hubicka
2014-06-24 20:31   ` Jeff Law
2014-06-26 16:02     ` Martin Liška
2014-06-26 18:46     ` Jan Hubicka
2014-06-30 12:05       ` Martin Liška
2014-07-01 23:45         ` Trevor Saunders
2014-06-30 19:06       ` Jeff Law
2014-06-16 10:07 ` [PATCH 4/5] Existing tests fix mliska
2014-06-17 19:52   ` Jeff Law
2014-06-17 20:50     ` Rainer Orth
2014-06-18  9:02       ` Martin Liška
2014-06-30 12:12     ` Martin Liška
2014-09-26 12:21       ` Martin Liška
2014-06-17 19:49 ` [PATCH 1/5] New Identical Code Folding IPA pass Jeff Law
2014-06-18 19:05   ` Jan Hubicka
2014-06-17 20:09 ` Paolo Carlini
2014-06-18  8:46   ` Martin Liška
2014-06-18  8:49     ` Paolo Carlini
2014-06-17 20:17 ` David Malcolm
2014-06-18  8:10   ` Martin Liška

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5422D3F1.7000909@suse.cz \
    --to=mliska@suse.cz \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).