From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) by sourceware.org (Postfix) with ESMTPS id 280F13858427 for ; Fri, 26 Aug 2022 13:35:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 280F13858427 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=ispras.ru Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=ispras.ru Received: from [10.10.3.121] (unknown [10.10.3.121]) by mail.ispras.ru (Postfix) with ESMTPS id 5BE9640D403D; Fri, 26 Aug 2022 13:35:40 +0000 (UTC) Date: Fri, 26 Aug 2022 16:35:40 +0300 (MSK) From: Alexander Monakov To: Martin Jambor cc: gcc-patches@gcc.gnu.org, Jan Hubicka , Artem Klimov Subject: Re: [PATCH v2] ipa-visibility: Optimize TLS access [PR99619] In-Reply-To: Message-ID: References: <20220707155341.5884-1-amonakov@ispras.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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? Alexander