From: Aldy Hernandez <aldyh@redhat.com>
To: Martin Jambor <mjambor@suse.cz>, GCC patches <gcc-patches@gcc.gnu.org>
Cc: Andrew MacLeod <amacleod@redhat.com>
Subject: Re: [COMMITTED] Remove deprecated range_fold_{unary, binary}_expr uses from ipa-*.
Date: Thu, 11 May 2023 11:58:17 +0200 [thread overview]
Message-ID: <5ec033e7-60a0-53c0-f44f-2a435646b2c5@redhat.com> (raw)
In-Reply-To: <ri6jzxmizkv.fsf@suse.cz>
On 5/5/23 17:10, Martin Jambor wrote:
> 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?
Sorry for the late response, but you're totally right. We're in dire
need of documentation here. I had planned to work on comments and
actual documentation much later this cycle, but I may need to bump that
up in priority.
>
>> + 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?"
Returning false from fold_range() is a shortcut for I don't know
anything, which will be treated as VARYING upstream.
The other methods also need documentation. The most important ones are
documented in range-op.h:
// This class is implemented for each kind of operator supported by
// the range generator. It serves various purposes.
particularly op1_range, and op2_range which can be confusing. But yes,
we need to revisit this, as those comments are pretty out of date.
Aldy
next prev parent reply other threads:[~2023-05-11 9:58 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 ` [COMMITTED] Remove deprecated range_fold_{unary, binary}_expr " Martin Jambor
2023-05-11 9:58 ` Aldy Hernandez [this message]
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=5ec033e7-60a0-53c0-f44f-2a435646b2c5@redhat.com \
--to=aldyh@redhat.com \
--cc=amacleod@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=mjambor@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).