From patchwork Tue May 11 13:59:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 1477149 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FffgC6bHjz9sCD for ; Tue, 11 May 2021 23:59:35 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6C044388CC0D; Tue, 11 May 2021 13:59:33 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 51AD238515E8 for ; Tue, 11 May 2021 13:59:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 51AD238515E8 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rguenther@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 36BEFAECB for ; Tue, 11 May 2021 13:59:29 +0000 (UTC) Date: Tue, 11 May 2021 15:59:28 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] More maybe_fold_reference TLC Message-ID: MIME-Version: 1.0 X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, 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: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" This removes stale users of maybe_fold_reference where IL constraints make it never do anything. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. 2021-05-11 Richard Biener * gimple-fold.c (gimple_fold_call): Do not call maybe_fold_reference on call arguments or the static chain. (fold_stmt_1): Do not call maybe_fold_reference on GIMPLE_ASM inputs. --- gcc/gimple-fold.c | 59 ----------------------------------------------- 1 file changed, 59 deletions(-) diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index 74ec36e3a78..68717cf1542 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -5447,19 +5447,6 @@ gimple_fold_call (gimple_stmt_iterator *gsi, bool inplace) gcall *stmt = as_a (gsi_stmt (*gsi)); tree callee; bool changed = false; - unsigned i; - - /* Fold *& in call arguments. */ - for (i = 0; i < gimple_call_num_args (stmt); ++i) - if (REFERENCE_CLASS_P (gimple_call_arg (stmt, i))) - { - tree tmp = maybe_fold_reference (gimple_call_arg (stmt, i)); - if (tmp) - { - gimple_call_set_arg (stmt, i, tmp); - changed = true; - } - } /* Check for virtual calls that became direct calls. */ callee = gimple_call_fn (stmt); @@ -5562,15 +5549,6 @@ gimple_fold_call (gimple_stmt_iterator *gsi, bool inplace) gimple_call_set_chain (stmt, NULL); changed = true; } - else - { - tree tmp = maybe_fold_reference (gimple_call_chain (stmt)); - if (tmp) - { - gimple_call_set_chain (stmt, tmp); - changed = true; - } - } } if (inplace) @@ -6285,43 +6263,6 @@ fold_stmt_1 (gimple_stmt_iterator *gsi, bool inplace, tree (*valueize) (tree)) changed |= gimple_fold_call (gsi, inplace); break; - case GIMPLE_ASM: - /* Fold *& in asm operands. */ - { - gasm *asm_stmt = as_a (stmt); - size_t noutputs; - const char **oconstraints; - const char *constraint; - bool allows_mem, allows_reg; - - noutputs = gimple_asm_noutputs (asm_stmt); - oconstraints = XALLOCAVEC (const char *, noutputs); - - for (i = 0; i < noutputs; ++i) - { - tree link = gimple_asm_output_op (asm_stmt, i); - oconstraints[i] - = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link))); - } - for (i = 0; i < gimple_asm_ninputs (asm_stmt); ++i) - { - tree link = gimple_asm_input_op (asm_stmt, i); - tree op = TREE_VALUE (link); - constraint - = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link))); - parse_input_constraint (&constraint, 0, 0, noutputs, 0, - oconstraints, &allows_mem, &allows_reg); - if (REFERENCE_CLASS_P (op) - && (allows_reg || !allows_mem) - && (op = maybe_fold_reference (op)) != NULL_TREE) - { - TREE_VALUE (link) = op; - changed = true; - } - } - } - break; - case GIMPLE_DEBUG: if (gimple_debug_bind_p (stmt)) {