public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Jambor <mjambor@suse.cz>
To: Feng Xue OS <fxue@os.amperecomputing.com>,
	Jan Hubicka <hubicka@ucw.cz>,
	"gcc-patches\@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH V2] Generalized value pass-through for self-recursive function (ipa/pr93203)
Date: Wed, 05 Feb 2020 17:27:00 -0000	[thread overview]
Message-ID: <ri6d0atndvz.fsf@suse.cz> (raw)
In-Reply-To: <BYAPR01MB48698368F177337119EF9040F7090@BYAPR01MB4869.prod.exchangelabs.com>

Hi,

On Sat, Jan 25 2020, Feng Xue OS wrote:
> Made some changes.
>
> Feng
>
> ________________________________________
> From: Feng Xue OS
> Sent: Saturday, January 25, 2020 5:54 PM
> To: mjambor@suse.cz; Jan Hubicka; gcc-patches@gcc.gnu.org
> Subject: [PATCH] Generalized value pass-through for self-recursive function (ipa/pr93203)
>
> Besides simple pass-through (aggregate) jump function, arithmetic (aggregate)
> jump function could also bring same (aggregate) value as parameter passed-in
> for self-feeding recursive call.  For example,
>
>       f1 (int i)    /*  normal jump function */
>          {
>             f1 (i & 1);
>          }
>
> Suppose i is 0, recursive propagation via (i & 1) also gets 0, which
> can be seen as a simple pass-through of i.
>
>       f2 (int *p)  /* aggregate jump function */
>          {
>             int t = *p & 1;
>             f2 (&t);
>          }
> Likewise, if *p is 0, (*p & 1) is also 0, and &t is an aggregate simple
> pass-through of p.
>
> This patch is to support these two kinds of value pass-through.
> Bootstrapped/regtested on x86_64-linux and aarch64-linux.

sorry for the delay in the review.  As far as I am concerned, I am OK
with the patch but please see the few comments below:

> ---
> 2020-01-25  Feng Xue  <fxue@os.amperecomputing.com>
>
>         PR ipa/93203
>         * ipa-cp.c (ipcp_lattice::add_value): Add source with same call
>         edge but different source value.
>         (adjust_callers_for_value_intersection): New function.
>         (gather_edges_for_value): Adjust order of callers to let a
>         non-self-recursive caller be the first element.
>         (self_recursive_pass_through_p): Add a new parameter simple, and
>         check generalized self-recursive pass-through jump function.
>         (self_recursive_agg_pass_through_p): Likewise.
>         (find_more_scalar_values_for_callers_subset): Compute value from
>         pass-through jump function for self-recursive.
>         (intersect_with_plats): Remove code of itersection with unknown
>         place holder value.
>         (intersect_with_agg_replacements): Likewise.
>         (intersect_aggregates_with_edge): Deduce with from pass-through
>         jump function for self-recursive.
>         (decide_whether_version_node): Remove dead callers and adjust
>         order to let a non-self-recursive caller be the first element.
>
> From 74aef0cd2f40ff828a4b2abcbbdbbf4b1aea1fcf Mon Sep 17 00:00:00 2001
> From: Feng Xue <fxue@os.amperecomputing.com>
> Date: Tue, 21 Jan 2020 20:53:38 +0800
> Subject: [PATCH] Generalized value pass-through for self-recusive function
>
> ---
>  gcc/ipa-cp.c                       | 195 ++++++++++++++++++-----------
>  gcc/testsuite/g++.dg/ipa/pr93203.C |  95 ++++++++++++++
>  gcc/testsuite/gcc.dg/ipa/ipcp-1.c  |   2 +-
>  3 files changed, 216 insertions(+), 76 deletions(-)
>  create mode 100644 gcc/testsuite/g++.dg/ipa/pr93203.C
>
> diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
> index 17da1d8e8a7..64d23a34292 100644
> --- a/gcc/ipa-cp.c
> +++ b/gcc/ipa-cp.c

...

> @@ -4817,19 +4867,12 @@ intersect_with_plats (class ipcp_param_lattices *plats,
>  	    break;
>  	  if (aglat->offset - offset == item->offset)
>  	    {
> -	      gcc_checking_assert (item->value);

I've been staring at this for quite a while, trying to figure out how
your patch can put NULL here before I realized it was just a clean-up
:-)  Sending such changes independently or pointing them out in the
email/ChangeLog makes review easier.

>  	      if (aglat->is_single_const ())
>  		{
>  		  tree value = aglat->values->value;
>  
>  		  if (values_equal_for_ipcp_p (item->value, value))
>  		    found = true;
> -		  else if (item->value == error_mark_node)
> -		    {
> -		      /* Replace unknown place holder value with real one.  */
> -		      item->value = value;
> -		      found = true;
> -		    }
>  		}
>  	      break;
>  	    }

...

> @@ -5564,7 +5610,6 @@ decide_whether_version_node (struct cgraph_node *node)
>  	}
>        clone = create_specialized_node (node, known_csts, known_contexts,
>  				       aggvals, callers);
> -      info = IPA_NODE_REF (node);

please either drop this change or change it to:

   gcc_checking_assert (info == IPA_NODE_REF (node));

this line of code was actually necessary when adding nodes possibly
invalidated addresses of all summaries - like fast_function_summary
classes still do.  So if we ever decide to use fast summaries we need a
test to remind us that info address must be obtained again.

Thanks for working on this!

Martin

  parent reply	other threads:[~2020-02-05 17:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-25 13:52 [PATCH] " Feng Xue OS
2020-01-25 16:17 ` [PATCH V2] " Feng Xue OS
2020-02-03  1:57   ` Ping* " Feng Xue OS
2020-02-05 17:27   ` Martin Jambor [this message]
2020-02-10  3:28     ` Feng Xue OS
2020-02-11 10:05       ` Tamar Christina
2020-02-11 13:10         ` Feng Xue OS
2020-02-11 14:31           ` Tamar Christina
2020-02-13  5:39             ` [PATCH] Fix bug in recursiveness check for function to be cloned (ipa/pr93707) Feng Xue OS
2020-02-17  8:44               ` Tamar Christina
2020-02-18 15:16                 ` Ping: " Feng Xue OS
2020-02-19 16:28               ` Martin Jambor
2020-02-20  3:36                 ` Feng Xue OS
2020-02-21 18:16                   ` Martin Jambor
2020-02-22  3:32                     ` Feng Xue OS
2020-02-24 15:41                       ` Martin Jambor
2020-02-20 12:57                 ` Tamar Christina

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=ri6d0atndvz.fsf@suse.cz \
    --to=mjambor@suse.cz \
    --cc=fxue@os.amperecomputing.com \
    --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).