public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Jambor <mjambor@suse.cz>
To: Alexander Monakov <amonakov@ispras.ru>
Cc: gcc-patches@gcc.gnu.org, Jan Hubicka <hubicka@kam.mff.cuni.cz>,
	Artem Klimov <jakmobius@gmail.com>
Subject: Re: [PATCH v2] ipa-visibility: Optimize TLS access [PR99619]
Date: Tue, 30 Aug 2022 13:44:49 +0200	[thread overview]
Message-ID: <ri6mtbmez0u.fsf@suse.cz> (raw)
In-Reply-To: <c6ea39b7-aed4-51fb-2972-b5471edb4a7e@ispras.ru>

On Fri, Aug 26 2022, Alexander Monakov wrote:
> On Fri, 26 Aug 2022, Martin Jambor wrote:
>
>> > +/* Check if promoting general-dynamic TLS access model to local-dynamic is
>> > +   desirable for DECL.  */
>> > +
>> > +static bool
>> > +optimize_dyn_tls_for_decl_p (const_tree decl)
>> > +{
>> > +  if (optimize)
>> > +    return true;
>> 
>> ...this.  This is again an access to optimize which in LTO IPA phase is
>> not really meaningful.  Can the test be simply removed?  If not (but
>> please look at why), I'd suggest to test the overall optimize level only
>> if there is a non-NULL cfun.
>
> I'd prefer to keep it. This code is also called from the front-ends when
> assigning initial TLS access model (during parsing, at the point where
> visibility attributes, if present, have not been processed yet). There
> we don't have IPA structures, but 'optimize' is set up.
>
> I also want to avoid iterating over referring functions in non-LTO mode
> where trusting 'optimize' should be fine during this IPA pass I think?

There is still the optimize attribute so in fact no, even in non-LTO
mode if there is no current function, you cannot trust the "global"
"optimize" thing.

Ideally we would assert that no "analysis" phase of an IPA pass reads
the global optimization flags, so please don't add new places where we
do.

You can either add a parameter to decl_default_tls_model to tell it
what context it is called from and IMHO it would also be acceptable to
check whether we have a non-NULL cfun and decide based on that (but here
I only hope it is not something others might object to).

Martin

  reply	other threads:[~2022-08-30 11:44 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-17 18:51 [PATCH] " Artem Klimov
2022-05-02  8:51 ` Alexander Monakov
2022-05-02 16:04 ` Martin Jambor
2022-05-02 16:43   ` Alexander Monakov
2022-05-09 16:06     ` Alexander Monakov
2022-05-09 16:47       ` Jan Hubicka
2022-05-09 17:15         ` Alexander Monakov
2022-05-16 15:50         ` Alexander Monakov
2022-05-23 10:56           ` Alexander Monakov
2022-05-25  9:04             ` Jan Hubicka
2022-07-07 15:53               ` [PATCH v2] " Alexander Monakov
2022-07-20 13:04                 ` Alexander Monakov
2022-08-05 14:03                   ` Alexander Monakov
2022-08-23 15:27                     ` Alexander Monakov
2022-08-26 11:32                 ` Martin Jambor
2022-08-26 13:35                   ` Alexander Monakov
2022-08-30 11:44                     ` Martin Jambor [this message]
2022-08-30 13:19                       ` Alexander Monakov
2022-08-30 14:03                         ` Alexander Monakov
2022-09-05 10:39                           ` Martin Jambor
2022-05-02 19:28   ` [PATCH] " Martin Liška
2022-05-05 10:50   ` Jan Hubicka
2022-05-05 11:50     ` Alexander Monakov
2022-05-05 11:56       ` Jan Hubicka
2022-05-05 14:41         ` Alexander Monakov

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=ri6mtbmez0u.fsf@suse.cz \
    --to=mjambor@suse.cz \
    --cc=amonakov@ispras.ru \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@kam.mff.cuni.cz \
    --cc=jakmobius@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).