public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Jambor <mjambor@suse.cz>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Cc: Jan Hubicka <jh@suse.cz>
Subject: Re: [PATCH 2/4] New parameter manipulation infrastructure
Date: Wed, 24 Jul 2019 13:19:00 -0000	[thread overview]
Message-ID: <ri61ryf4mbg.fsf@suse.cz> (raw)
In-Reply-To: <9d526176d66c53e25de22b7c407bb4c5292ef982.1563901251.git.mjambor@suse.cz>

Hello,

On Tue, Jul 23 2019, Martin Jambor wrote:
> This patch adds the capability to split parameters directly to the
> call graph cloning infrastructure, while still allowing omp-simd to
> clone functions on its own.  Please see the cover letter for the whole
> IPA-SRA patch-set for more details.
>
> Martin
>
> 2019-07-23  Martin Jambor  <mjambor@suse.cz>
>
>         * Makefile.in (GTFILES): Added ipa-param-manipulation.h.
>         * cgraph.h (ipa_replace_map): Removed fields old_tree, replace_p
>         and ref_p, added fields param_adjustments and performed_splits.
>         (struct cgraph_clone_info): Remove ags_to_skip and
>         combined_args_to_skip, new field param_adjustments.
>         (cgraph_node::create_clone): Changed parameters to use
>         ipa_param_adjustments.
>         (cgraph_node::create_virtual_clone): Likewise.
>         (cgraph_node::create_virtual_clone_with_body): Likewise.
>         (tree_function_versioning): Likewise.
>         (cgraph_build_function_type_skip_args): Removed.
>         * cgraph.c (cgraph_edge::redirect_call_stmt_to_callee): Convert to
>         using ipa_param_adjustments.
>         (clone_of_p): Likewise.
>         * cgraphclones.c (cgraph_build_function_type_skip_args): Removed.
>         (build_function_decl_skip_args): Likewise.
>         (duplicate_thunk_for_node): Adjust parameters using
>         ipa_param_body_adjustments, copy param_adjustments instead of
>         args_to_skip.
>         (cgraph_node::create_clone): Convert to using ipa_param_adjustments.
>         (cgraph_node::create_virtual_clone): Likewise.
>         (cgraph_node::create_version_clone_with_body): Likewise.
>         (cgraph_materialize_clone): Likewise.
>         (symbol_table::materialize_all_clones): Likewise.
>         * coretypes.h (cgraph_edge): Declare.
>         * ipa-cp.c (get_replacement_map): Do not initialize removed fields.
>         (initialize_node_lattices): Make aware that some parameters might have
>         already been removed.
>         (want_remove_some_param_p): New function.
>         (create_specialized_node): Convert to using ipa_param_adjustments and
>         deal with possibly pre-existing adjustments.
>         * ipa-fnsummary.c (ipa_fn_summary_t::duplicate): Simplify
>         ipa_replace_map check.
>         * ipa-inline-transform.c (save_inline_function_body): Update to
>         refelct new tree_function_versioning signature.
>         * ipa-param-manipulation.c: Rewrite.
>         * ipa-param-manipulation.h: Likewise.
>         * ipa-prop.c (adjust_agg_replacement_values): Use a helper from
>         ipa_param_adjustments to get current parameter indices.
>         (ipcp_modif_dom_walker::before_dom_children): Likewise.
>         (ipcp_update_bits): Likewise.
>         (ipcp_update_vr): Likewise.
>         * ipa-split.c (split_function): Convert to using ipa_param_adjustments.
>         * lto-cgraph.c (output_cgraph_opt_summary_p): Likewise.
>         (output_node_opt_summary): Do not stream removed fields.  Stream
>         parameter adjustments instead of argumetns to skip.
>         (input_node_opt_summary): Likewise.
>         (input_node_opt_summary): Likewise.
>         * multiple_target.c (create_target_clone): Update to reflet new type
>         of create_version_clone_with_body.
>         * omp-simd-clone.c (simd_clone_vector_of_formal_parm_types): Adjust
>         for the new interface.
>         (simd_clone_clauses_extract): Likewise, make args an auto_vec.
>         (simd_clone_compute_base_data_type): Likewise.
>         (simd_clone_init_simd_arrays): Adjust for the new interface.
>         (simd_clone_adjust_argument_types): Likewise.
>         (struct modify_stmt_info): Likewise.
>         (ipa_simd_modify_stmt_ops): Likewise.
>         (ipa_simd_modify_function_body): Likewise.
>         (simd_clone_adjust): Likewise.
>         * trans-mem.c (ipa_tm_create_version): Update to reflect new type of
>         tree_function_versioning.
>         * tree-inline.h (copy_body_data): New fields killed_new_ssa_names and
> 	param_body_adjs.
>         (copy_decl_to_var): Declare.
>         * tree-inline.c (update_clone_info): Do not remap old_tree.
>         (remap_gimple_stmt): Use ipa_param_body_adjustments to modify gimple
>         statements, walk all extra generated statements and remap their
>         operands.
>         (redirect_all_calls): Add killed SSA names to a hash set.
>         (remap_ssa_name): Do not remap killed SSA names.
>         (copy_arguments_for_versioning): Renames to copy_arguments_nochange,
>         half of functionality moved to ipa_param_body_adjustments.
>         (copy_decl_to_var): Make exported.
>         (copy_body): Destroy killed_new_ssa_names hash set.
>         (expand_call_inline): Remap performed splits.
>         (update_clone_info): Likewise.
>         (tree_function_versioning): Simplify tree_map processing.  Updated to
>         accept ipa_param_adjustments and use ipa_param_body_adjustments.


Honza's experiments with Firefox building already found one bug, we
cannot rely on an edge surviving accross a call to
edge->redirect_call_stmt_to_callee (umm, yes, it frees its this
pointer).  Fortunately, all we need is the new call statement that is
returned by the function, so the following is needed on top of the patch
from yesterday.

Martin


diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index e156f60ba2a..eddcef69505 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -2897,14 +2897,14 @@ redirect_all_calls (copy_body_data * id, basic_block bb)
 	  struct cgraph_edge *edge = id->dst_node->get_edge (stmt);
 	  if (edge)
 	    {
-	      edge->redirect_call_stmt_to_callee ();
+	      gimple *new_stmt = edge->redirect_call_stmt_to_callee ();
 	      /* If IPA-SRA transformation, run as part of edge redirection,
 		 removed the LHS because it is unused, save it to
 		 killed_new_ssa_names so that we can prune it from debug
 		 statements.  */
 	      if (old_lhs
 		  && TREE_CODE (old_lhs) == SSA_NAME
-		  && !gimple_call_lhs (edge->call_stmt))
+		  && !gimple_call_lhs (new_stmt))
 		{
 		  if (!id->killed_new_ssa_names)
 		    id->killed_new_ssa_names = new hash_set<tree> (16);

  reply	other threads:[~2019-07-24 13:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-23 17:08 [PATCH 0/4] True IPA reimplementation of IPA-SRA (v3) Martin Jambor
2019-07-23 17:08 ` [PATCH 1/4] Remove old IPA-SRA, introduce tree-sra.h Martin Jambor
2019-07-24 19:50   ` Jeff Law
2019-07-23 17:08 ` [PATCH 4/4] Modifications to the testsuite Martin Jambor
2019-08-09 21:50   ` Jeff Law
2019-07-23 17:09 ` [PATCH 3/4] New IPA-SRA implementation Martin Jambor
2019-07-23 17:20 ` [PATCH 2/4] New parameter manipulation infrastructure Martin Jambor
2019-07-24 13:19   ` Martin Jambor [this message]
2019-08-21 17:32 [PATCH 0/4] True IPA reimplementation of IPA-SRA (v4) Martin Jambor
2019-08-21 18:09 ` [PATCH 2/4] New parameter manipulation infrastructure Martin Jambor
2019-09-13 17:40   ` Jan Hubicka
2019-09-19  9:55     ` Martin Jambor

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=ri61ryf4mbg.fsf@suse.cz \
    --to=mjambor@suse.cz \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jh@suse.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).