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 0544D3898C6A for ; Mon, 16 May 2022 15:50:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0544D3898C6A Received: from [10.10.3.121] (unknown [10.10.3.121]) by mail.ispras.ru (Postfix) with ESMTPS id B3154407625A; Mon, 16 May 2022 15:50:40 +0000 (UTC) Date: Mon, 16 May 2022 18:50:40 +0300 (MSK) From: Alexander Monakov To: Jan Hubicka cc: Martin Jambor , Artem Klimov , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] ipa-visibility: Optimize TLS access [PR99619] In-Reply-To: Message-ID: <4e7a3a6a-b437-7ddc-7acb-febcef942f4f@ispras.ru> References: <20220417185113.25780-1-jakmobius@gmail.com> <381c469c-516e-808f-f811-314eddaf2ba9@ispras.ru> <5e8789c-7394-7521-33ae-70375d9a28@ispras.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-2.9 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 May 2022 15:50:47 -0000 On Mon, 9 May 2022, Jan Hubicka wrote: > > On second thought, it might be better to keep the assert, and place the loop > > under 'if (optimize)'? > > The problem is that at IPA level it does not make sense to check > optimize flag as it is function specific. (shlib is OK to check it > anywhere since it is global.) > > So I think we really want to run the code only at the WPA time > (symtab_state>=IPA_SSA) and we want to see what is optimization flag of > those function referring the variable since that is what decided codegen > we will produce. Perhaps I misunderstood the issue. Are you saying that there might be no -O option on lto1 command line, because lto1 is supposed to take optimization level from function summaries, but during pass_ipa_whole_program_visibility there's no "current function" so 'optimize' is at its default value (zero)? And the solution is to iterate over referring functions to see if at least one of them satisfies 'opt_for_fn (decl, optimize) > 0'? Alexander