From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id 545143857C72 for ; Tue, 30 Aug 2022 11:44:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 545143857C72 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id D59251FA55; Tue, 30 Aug 2022 11:44:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1661859889; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=MEyv8IAsNp77mRU7ruMVhSVWfcCEE+vFYR+sK5w73Lc=; b=sOYR0+ja8X63Is42fars3bEA7wMdUAps1sluLnOeHusrCu1XbHcFSITZK8mm5Tk9P/lZJk NBjkqMj66m0QzR/Nx6yPuz4EvYZzLiqyUea5wkkHkKx+19ArSe4lgzfKpyXR01UIcZDmAe b/2xrisa7LRryVYXzXWycrgIponv1wA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1661859889; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=MEyv8IAsNp77mRU7ruMVhSVWfcCEE+vFYR+sK5w73Lc=; b=mT9WA0+5AwS3bp2l1GLm4hK6hYUGe2nlhVPoApUY2Zr0jTlfaeiKBZd57pBeVyDqvuHr+7 5jvawFsUM2jnxOBw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id C720013ACF; Tue, 30 Aug 2022 11:44:49 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id B5SVMDH4DWOZUgAAMHmgww (envelope-from ); Tue, 30 Aug 2022 11:44:49 +0000 From: Martin Jambor To: Alexander Monakov Cc: gcc-patches@gcc.gnu.org, Jan Hubicka , Artem Klimov Subject: Re: [PATCH v2] ipa-visibility: Optimize TLS access [PR99619] In-Reply-To: References: <20220707155341.5884-1-amonakov@ispras.ru> User-Agent: Notmuch/0.35 (https://notmuchmail.org) Emacs/28.1 (x86_64-suse-linux-gnu) Date: Tue, 30 Aug 2022 13:44:49 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_SOFTFAIL,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no 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, 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