From patchwork Mon Dec 12 16:53:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Jambor X-Patchwork-Id: 32459 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2350946wrr; Mon, 12 Dec 2022 08:56:39 -0800 (PST) X-Google-Smtp-Source: AA0mqf6vbnYHui/+7sncKJdH41tY10dJT9Smyp5s7V6E21iOj1n31DNJcWZozGEl4pKMX1Uo/Dja X-Received: by 2002:aa7:cd8d:0:b0:45c:835b:ac6a with SMTP id x13-20020aa7cd8d000000b0045c835bac6amr14814782edv.37.1670864199656; Mon, 12 Dec 2022 08:56:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670864199; cv=none; d=google.com; s=arc-20160816; b=awWEhbkDl+ZpvSpDUsadqjiRKHbrVcRpwxGT1RStWk2FYQ6VaQ3XSiUVrcDSyIBZKh +0gHPeCzQ0CZoctt555K8tKkt8UQwPGWdWQeJWiUCN6L2ET3zmKj1Shz3yT95j6JtTNu PXfmojdf/3wgnFJyMLuA37Dqj7HS+ISyz8rDKwKo4kyxKNfhzcGkOyHElsxFxBgj95lO D9iei4tSh7er8Ucm0Lwvwv09pVtH/tqaS0pRz3up22U3P/vVEepdOPCTo30GGDQyFkgc 94+LJrL78ndFtesF4/M2Ck69AmmxBV8889vDvd+zInIo4WOQYlACD5atCRNdlYyMXG6G rKYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version:message-id:date :user-agent:subject:cc:to:from:dkim-signature:dkim-signature :dmarc-filter:delivered-to; bh=KoitavFC+yL5/kZaevrIF92WvIVvCCEPWbBEc+xCuzo=; b=jjZzuxYIfY5yOMcN4KFBkIykunXbWiaYuw10x93qRXiPROPmzkNO3/sgowsecUoKyK OHG0zlEXDxdCg1xn7v4Hfvs36Pnw5DeD2Dl99WwEw1OpRlPyZq6svG3XZjJWRXLDRpL6 8kCf3eTxpo4aPDV+eFo9y+iJHRzbUdQMf4sDFCXyi0yhbBLSAQakLOm8iOb6/zP/ZEVF lPzWVrff1D68kH22mA0b7nhrPgmc+TAH6XERV5M0M/2DlCnAQx0qzzkyfdgOzAnP5Bi7 ySV6n44gtdZcdFFQA7Tk0A7PI5z6rN0sHlklBcKCtL1UzInHZEa5LgS9rEsaCqkn5ZH9 W2HA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=Endai0Nw; dkim=neutral (no key) header.i=@gcc.gnu.org header.s=susede2_ed25519 header.b=OHh+U1bl; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id d7-20020a1709067f0700b007c0d40cd759si4666343ejr.827.2022.12.12.08.56.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Dec 2022 08:56:39 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=Endai0Nw; dkim=neutral (no key) header.i=@gcc.gnu.org header.s=susede2_ed25519 header.b=OHh+U1bl; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3262538717F8 for ; Mon, 12 Dec 2022 16:54:37 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id 154973850628 for ; Mon, 12 Dec 2022 16:53:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 154973850628 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 111751FDE6; Mon, 12 Dec 2022 16:53:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1670864036; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type; bh=KoitavFC+yL5/kZaevrIF92WvIVvCCEPWbBEc+xCuzo=; b=Endai0Nwt2UPhAKDCZvw3NhsHZdgBC0ijcQmd+WXVpihqKkKsi+BKIT9X7bQq5ddxHvIbx YIjbXnmbuVzaKmub7RQa5DR4M4br3kIrOP48mZycO1DYuaKw6dX/mLM9Tk9Nznd7Ic2vpW CU59Hm7xYBky4HxxYHdGYwYODi9Qa9Q= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1670864036; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type; bh=KoitavFC+yL5/kZaevrIF92WvIVvCCEPWbBEc+xCuzo=; b=OHh+U1bljruAJPu14NznxHciqB6XY8SRNgWVqnByd950B+MM3Gf5kKZ+m5r0n30S3xALq/ skFueEK2KqrqVVDA== 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 019A913456; Mon, 12 Dec 2022 16:53:56 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ct0xAKRcl2NHEwAAMHmgww (envelope-from ); Mon, 12 Dec 2022 16:53:56 +0000 From: Martin Jambor To: GCC Patches Cc: Jan Hubicka , Jan Hubicka Subject: [PATCH 9/9] ipa: Avoid looking for IPA-SRA replacements where there are none User-Agent: Notmuch/0.37 (https://notmuchmail.org) Emacs/28.1 (x86_64-suse-linux-gnu) Date: Mon, 12 Dec 2022 17:53:55 +0100 Message-ID: MIME-Version: 1.0 X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_SOFTFAIL, TXREP 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: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752028098799758461?= X-GMAIL-MSGID: =?utf-8?q?1752028098799758461?= Hi, I'm re-posting patches which I have posted at the end of stage 1 but which have not passed review yet. 8<-------------------------------------------------------------------- While modifying the code, I realized that we do look into statements even when there are no replacements. This patch adds the necessary early bail-outs to avoid that. ipa_param_body_adjustments::modify_call_stmt cannot have the same at the very beginning because calls can still contain otherwise removed parameters that need to be removed from the statements too. Bootstrapped and tested individually when I originally posted it and now bootstrapped and LTO-bootstrapped and tested as part of the whole series. OK for master? gcc/ChangeLog: 2022-11-11 Martin Jambor * ipa-param-manipulation.cc (ipa_param_body_adjustments::modify_expression): Bail out early if there are no replacements. (ipa_param_body_adjustments::modify_assignment): Likewise. gcc/testsuite/ChangeLog: 2022-11-11 Martin Jambor PR ipa/103227 PR ipa/107640 * gcc.dg/ipa/pr107640-2.c: New test. --- gcc/ipa-param-manipulation.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gcc/ipa-param-manipulation.cc b/gcc/ipa-param-manipulation.cc index e92cfc0b6d5..da19d64cbce 100644 --- a/gcc/ipa-param-manipulation.cc +++ b/gcc/ipa-param-manipulation.cc @@ -1762,6 +1762,8 @@ ipa_param_body_adjustments::modify_expression (tree *expr_p, bool convert) { tree expr = *expr_p; + if (m_replacements.is_empty ()) + return false; if (TREE_CODE (expr) == BIT_FIELD_REF || TREE_CODE (expr) == IMAGPART_EXPR || TREE_CODE (expr) == REALPART_EXPR) @@ -1809,7 +1811,7 @@ ipa_param_body_adjustments::modify_assignment (gimple *stmt, tree *lhs_p, *rhs_p; bool any; - if (!gimple_assign_single_p (stmt)) + if (m_replacements.is_empty () || !gimple_assign_single_p (stmt)) return false; rhs_p = gimple_assign_rhs1_ptr (stmt);