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: Andrew MacLeod <amacleod@redhat.com>, Aldy Hernandez <aldyh@redhat.com>
Subject: Re: [COMMITTED] Remove deprecated range_fold_{unary, binary}_expr uses from ipa-*.
Date: Fri, 05 May 2023 17:10:24 +0200	[thread overview]
Message-ID: <ri6jzxmizkv.fsf@suse.cz> (raw)
In-Reply-To: <20230426083328.313566-4-aldyh@redhat.com>

Hello,

On Wed, Apr 26 2023, Aldy Hernandez via Gcc-patches wrote:
> gcc/ChangeLog:
>
> 	* ipa-cp.cc (ipa_vr_operation_and_type_effects): Convert to ranger API.
> 	(ipa_value_range_from_jfunc): Same.
> 	(propagate_vr_across_jump_function): Same.
> 	* ipa-fnsummary.cc (evaluate_conditions_for_known_args): Same.
> 	* ipa-prop.cc (ipa_compute_jump_functions_for_edge): Same.
> 	* vr-values.cc (bounds_of_var_in_loop): Same.

thanks for taking care of the value range uses in IPA.

> ---
>  gcc/ipa-cp.cc        | 28 +++++++++++++++++++++------
>  gcc/ipa-fnsummary.cc | 45 ++++++++++++++++++++++++++++----------------
>  gcc/ipa-prop.cc      |  5 ++---
>  gcc/vr-values.cc     |  6 ++++--
>  4 files changed, 57 insertions(+), 27 deletions(-)
>
> diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc
> index 65c49558b58..6788883c40b 100644
> --- a/gcc/ipa-cp.cc
> +++ b/gcc/ipa-cp.cc
> @@ -128,6 +128,7 @@ along with GCC; see the file COPYING3.  If not see
>  #include "attribs.h"
>  #include "dbgcnt.h"
>  #include "symtab-clones.h"
> +#include "gimple-range.h"
>  
>  template <typename valtype> class ipcp_value;
>  
> @@ -1900,10 +1901,15 @@ ipa_vr_operation_and_type_effects (value_range *dst_vr,
>  				   enum tree_code operation,
>  				   tree dst_type, tree src_type)
>  {
> -  range_fold_unary_expr (dst_vr, operation, dst_type, src_vr, src_type);
> -  if (dst_vr->varying_p () || dst_vr->undefined_p ())
> +  if (!irange::supports_p (dst_type) || !irange::supports_p (src_type))
>      return false;
> -  return true;
> +
> +  range_op_handler handler (operation, dst_type);

Would it be possible to document the range_op_handler class somewhat?

> +  return (handler
> +	  && handler.fold_range (*dst_vr, dst_type,
> +				 *src_vr, value_range (dst_type))
> +	  && !dst_vr->varying_p ()
> +	  && !dst_vr->undefined_p ());

It looks important but the class is not documented at all.  Although the
use of fold_range is probably hopefully mostly clear from its uses in
this patch, the meaning of the return value of this method and what
other methods do is less obvious.

For example, I am curious why (not in this patch, but in the code as it
is now in the repo), uses of fold_range seem to be always preceeded with
a check for supports_type_p, even though the type is then also fed into
fold_range itself.  Does the return value of fold_range mean something
slightly different from "could not deduce anything?"

Thanks!

Martin

  reply	other threads:[~2023-05-05 15:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-26  8:33 [COMMITTED] Remove compare_names* from legacy cond folding Aldy Hernandez
2023-04-26  8:33 ` [COMMITTED] Refactor vrp_evaluate_conditional* and rename it Aldy Hernandez
2023-04-26  8:33 ` [COMMITTED] Remove range_query::get_value_range Aldy Hernandez
2023-04-26  8:33 ` [COMMITTED] Remove deprecated range_fold_{unary,binary}_expr uses from ipa-* Aldy Hernandez
2023-05-05 15:10   ` Martin Jambor [this message]
2023-05-11  9:58     ` [COMMITTED] Remove deprecated range_fold_{unary, binary}_expr " Aldy Hernandez
2023-05-15 17:33     ` Aldy Hernandez
2023-04-26  8:33 ` [COMMITTED] Remove range_fold_{unary,binary}_expr Aldy Hernandez
2023-04-26  8:33 ` [COMMITTED] Remove irange::may_contain_p Aldy Hernandez
2023-04-26  8:33 ` [COMMITTED] Remove symbolics from irange Aldy Hernandez
2023-04-26  8:33 ` [COMMITTED] Remove irange::constant_p Aldy Hernandez
2023-04-26  8:33 ` [COMMITTED] Convert users of legacy API to get_legacy_range() function Aldy Hernandez

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=ri6jzxmizkv.fsf@suse.cz \
    --to=mjambor@suse.cz \
    --cc=aldyh@redhat.com \
    --cc=amacleod@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /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).