From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1611) id 0DE96383F23F; Wed, 14 Dec 2022 00:04:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0DE96383F23F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1670976288; bh=Hl9T7JrDRFtdSIvwo5ophMj6yKrvsxtVIhrAxElrIig=; h=From:To:Subject:Date:From; b=JO+/JANgdP//mBfRXs3RdpwDND638nAX1xFObcHDZFLJvX5mnMzY/qc4Po8IOUG+b Q5pZVIEqP2aTCzzpxjMKJKk5BN63ms+GqtJoDDODkH32FGLByjU3mory13fYvX2vbQ nENV2K2COdK/1g8nzYBvBdh/crC78bC5SYrkIzFk= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Martin Jambor To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-4691] ipa: Avoid looking for IPA-SRA replacements where there are none X-Act-Checkin: gcc X-Git-Author: Martin Jambor X-Git-Refname: refs/heads/master X-Git-Oldrev: f2cf4c6121d2b350bb66ed6763e81b77a585846d X-Git-Newrev: 8a263116d4375892bf67ceaaf2575935cd99edd0 Message-Id: <20221214000448.0DE96383F23F@sourceware.org> Date: Wed, 14 Dec 2022 00:04:47 +0000 (GMT) List-Id: https://gcc.gnu.org/g:8a263116d4375892bf67ceaaf2575935cd99edd0 commit r13-4691-g8a263116d4375892bf67ceaaf2575935cd99edd0 Author: Martin Jambor Date: Wed Dec 14 00:33:06 2022 +0100 ipa: Avoid looking for IPA-SRA replacements where there are none 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. 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. Diff: --- 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);