From: Aldy Hernandez <aldyh@redhat.com>
To: Richard Biener <richard.guenther@gmail.com>,
Andrew MacLeod <amacleod@redhat.com>
Cc: Andrew Pinski <pinskia@gmail.com>, GCC Mailing List <gcc@gcc.gnu.org>
Subject: Re: get_range_query vs NULL argument
Date: Thu, 16 Feb 2023 09:10:36 +0100 [thread overview]
Message-ID: <4f6718af-e17a-41ef-a886-f45e4ac3d7a4@redhat.com> (raw)
In-Reply-To: <CAFiYyc0GZY+nOFFhed5PyrCEyn+85m+QGgnNj03QYmYDb6PzyQ@mail.gmail.com>
On 2/16/23 08:57, Richard Biener wrote:
> On Wed, Feb 15, 2023 at 11:31 PM Andrew MacLeod via Gcc <gcc@gcc.gnu.org> wrote:
>>
>>
>> On 2/15/23 14:50, Andrew Pinski wrote:
>>> Hi,
>>> While fixing PR 108354, I came across that
>>> ssa_name_has_boolean_range calls get_range_query with cfun as the
>>> argument but sometimes while in IPA passes cfun is currently nullptr.
>>> The question should we check the argument before calling
>>> get_range_query or is it a valid thing to call it with a nullptr (and
>>> have it return global_ranges in that case)?
>>
>> That might be ok... personally I see nothing wrong with:
>>
>> diff --git a/gcc/value-query.h b/gcc/value-query.h
>> index 63878968118..2d7bf8fcf33 100644
>> --- a/gcc/value-query.h
>> +++ b/gcc/value-query.h
>> @@ -140,7 +140,7 @@ get_global_range_query ()
>> ATTRIBUTE_RETURNS_NONNULL inline range_query *
>> get_range_query (const struct function *fun)
>> {
>> - return fun->x_range_query ? fun->x_range_query : &global_ranges;
>> + return (fun && fun->x_range_query) ? fun->x_range_query : &global_ranges;
>> }
>>
>> // Query the global range of NAME in function F. Default to cfun.
>>
>>
>> The client is probably going to do that anyway.
>
> But if there's no 'fun', what is 'global_ranges' initialized for? Or
> is 'global_ranges'
> usable in IPA context?
If there is no fun, global_ranges will just return what get_range_info()
used to return (i.e. SSA_NAME_RANGE_INFO).
Aldy
next prev parent reply other threads:[~2023-02-16 8:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-15 19:50 Andrew Pinski
2023-02-15 22:30 ` Andrew MacLeod
2023-02-16 7:57 ` Richard Biener
2023-02-16 8:10 ` Aldy Hernandez [this message]
2023-02-17 17:13 ` Andrew Pinski
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=4f6718af-e17a-41ef-a886-f45e4ac3d7a4@redhat.com \
--to=aldyh@redhat.com \
--cc=amacleod@redhat.com \
--cc=gcc@gcc.gnu.org \
--cc=pinskia@gmail.com \
--cc=richard.guenther@gmail.com \
/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).