From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nikam.ms.mff.cuni.cz (nikam.ms.mff.cuni.cz [195.113.20.16]) by sourceware.org (Postfix) with ESMTPS id 9FBBD385040C for ; Sun, 29 Nov 2020 15:37:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9FBBD385040C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ucw.cz Authentication-Results: sourceware.org; spf=none smtp.mailfrom=hubicka@kam.mff.cuni.cz Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 7DF10282764; Sun, 29 Nov 2020 16:37:23 +0100 (CET) Date: Sun, 29 Nov 2020 16:37:23 +0100 From: Jan Hubicka To: Richard Biener Cc: GCC Patches Subject: Re: Handle EAF_DIRECT and EAF_UNUSED of pure calls Message-ID: <20201129153723.GA33507@kam.mff.cuni.cz> References: <20201125141320.GB41776@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-14.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Sun, 29 Nov 2020 15:37:27 -0000 > On Wed, Nov 25, 2020 at 3:14 PM Jan Hubicka wrote: > > > > Hi, > > while looking into structalias I noticed that we ignore EAF flags here. > > This is pity since we still can apply direct and unused. > > This patch simply copies logic from normal call handling. I relaize that > > it is bit more expensive by creating callarg and doing transitive > > closure there instead of doing one common transitive closure on call use. > > I can also scan first if there are both direct and !direct argument and > > do this optimization, but it does not seem to affect build times (tested > > on spec2k6 gcc LTO build) > > > > lto-boostrapped/regtested x86_64-linux. > > OK. Hi, I actually noticed that I missed to update handling of static chain and NRV values, but while testing updated patch I also found that it has no measurable effect on cc1plus and I failed to construct testcase where handling of EAF_DIRECT would do somehting useful. The points-to set of returned value contains all eascape and nonlocal solutions (as it should). So I decided to commit only the EAF_UNUSED part. As it stands EAF_DIRECT handling only makes constraint graph bigger for no much benefit. I think to make return values useful we need to also use the info about global memory uses. This is easilly available from modref but doing so seems non-trivial since pure functions can return addresses of global symbols but NONLOCAL solution is too big for that. Honza * tree-ssa-structalias.c (handle_pure_call): Skip EAF_UNUSED parameters. diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 9f4de96d544..cf653be8b6d 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -4274,6 +4274,11 @@ handle_pure_call (gcall *stmt, vec *results) for (i = 0; i < gimple_call_num_args (stmt); ++i) { tree arg = gimple_call_arg (stmt, i); + int flags = gimple_call_arg_flags (stmt, i); + + /* If the argument is not used we can ignore it. */ + if (flags & EAF_UNUSED) + continue; if (!uses) { uses = get_call_use_vi (stmt);