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 2B1923857811 for ; Wed, 25 Nov 2020 14:13:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2B1923857811 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 07E492827C5; Wed, 25 Nov 2020 15:13:20 +0100 (CET) Date: Wed, 25 Nov 2020 15:13:20 +0100 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: Handle EAF_DIRECT and EAF_UNUSED of pure calls Message-ID: <20201125141320.GB41776@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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: Wed, 25 Nov 2020 14:13:26 -0000 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. Honza diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index a4832b75436..5f84f7d467f 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -4253,12 +4253,20 @@ 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 (flags & EAF_UNUSED) + continue; + if (!uses) - { - uses = get_call_use_vi (stmt); - make_any_offset_constraints (uses); - make_transitive_closure_constraints (uses); - } + uses = get_call_use_vi (stmt); + varinfo_t tem = new_var_info (NULL_TREE, "callarg", true); + tem->is_reg_var = true; + make_constraint_to (tem->id, arg); + make_any_offset_constraints (tem); + if (!(flags & EAF_DIRECT)) + make_transitive_closure_constraints (tem); + make_copy_constraint (uses, tem->id); make_constraint_to (uses->id, arg); }