From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 56944385840C for ; Wed, 1 Dec 2021 17:29:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 56944385840C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id DD3DB212CB for ; Wed, 1 Dec 2021 17:29:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1638379752; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=bLNyv+DcRH6RRrSz22W1ZO3rFpuzDpewy5tQ8ANHhVw=; b=0rArWOlBdyvvhbwRc5HXCk3vvSM4S6wDM8ENrwIoba12hGJSg8ZAttwcnFWxj9Su0S5hCZ sb9hRfpDER+/+HVPcW28mGEhvsDo46hf4EPfZPq68w12Fzk3UWtanEO+bPK7Ucwrb2/e6Z j9ebqRNxF1pHGVKKZvlM5MgSNPYtF4g= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1638379752; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=bLNyv+DcRH6RRrSz22W1ZO3rFpuzDpewy5tQ8ANHhVw=; b=rQoN5Qos+J3WuqzWjaqlvsDIw6ZcZk9BSHEvY2+AgO8L861oPYpcQ+y2afy8uMiMnwvQpu aeu4T2oZfrSo/zDg== Received: from suse.cz (virgil.suse.cz [10.100.13.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id C9D80A3B83 for ; Wed, 1 Dec 2021 17:29:12 +0000 (UTC) From: Martin Jambor To: GCC Patches Subject: Re: [PATCH] ipa-sra: Check also ECF_LOOPING_CONST_OR_PURE when evaluating calls In-Reply-To: References: User-Agent: Notmuch/0.34.1 (https://notmuchmail.org) Emacs/27.2 (x86_64-suse-linux-gnu) Date: Wed, 01 Dec 2021 18:29:12 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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, 01 Dec 2021 17:29:15 -0000 On Tue, Nov 30 2021, Richard Biener wrote: > On Tue, Nov 30, 2021 at 3:24 PM Martin Jambor wrote: >> >> Hi, >> >> in PR 103267 Honza found out that IPA-SRA does not look at >> ECF_LOOPING_CONST_OR_PURE when evaluating if a call can have side >> effects. Fixed with this patch. The testcase infinitely loops in a >> const function, so it would not make a good addition to the testsuite. >> >> Bootstrapped and tested on x86_64-linux. OK for trunk? > > OK. > Thank you. For reference, I am also about to commit (after having bootstrapped and tested it on x86_64-linx) the following backport to the old IPA-SRA we have in GCC 9. Thanks, Martin gcc/ChangeLog: 2021-12-01 Martin Jambor PR ipa/103267 * tree-sra.c (scan_function): Also check ECF_LOOPING_CONST_OR_PURE flag. --- gcc/tree-sra.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 909b4fef9a8..252953b7512 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -1530,7 +1530,8 @@ scan_function (void) } if (final_bbs - && (flags & (ECF_CONST | ECF_PURE)) == 0) + && ((flags & (ECF_CONST | ECF_PURE)) == 0 + || (flags & ECF_LOOPING_CONST_OR_PURE))) bitmap_set_bit (final_bbs, bb->index); } -- 2.33.1