Message ID | ri6v909g1tu.fsf@suse.cz |
---|---|
State | Committed |
Commit | e5440bc08e07fd491dcccd47e1b86a5985ee117c |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0AC3E385BF9D for <patchwork@sourceware.org>; Tue, 30 Nov 2021 14:24:12 +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 [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 1EC14385802A for <gcc-patches@gcc.gnu.org>; Tue, 30 Nov 2021 14:22:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1EC14385802A 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-out2.suse.de (Postfix) with ESMTP id 0C95A1FD59; Tue, 30 Nov 2021 14:22:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1638282174; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type; bh=RIADkxzq9aXzVjerp5OvdBd7catQLSxFbO6vn1OVwsA=; b=LxMM4PGAw/6/7rJkQrxNJfv+/n7l2oS52UCZ6EdfmChf3F4wuslnfnbKMeXTJafZiLj0IT bJUINAp0fjjANt1TkBGMfTkkRrhQ83WU2Rf2XVWe8VDS+LySkVHcSHj3twdFEKYrGb82LQ nsbKj2brK140MDV2i+JyfLCxhB3fiLM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1638282174; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type; bh=RIADkxzq9aXzVjerp5OvdBd7catQLSxFbO6vn1OVwsA=; b=mBafvoq9rpjudYVYmU72sXCQNqGPFXhCCGVX/2a4nVhHbDAJp2m2imEVQ2Upa3CD5jxxLh qAzx8tPi7LVfg6CQ== 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 ED586A3B81; Tue, 30 Nov 2021 14:22:53 +0000 (UTC) From: Martin Jambor <mjambor@suse.cz> To: GCC Patches <gcc-patches@gcc.gnu.org> Subject: [PATCH] ipa-sra: Check also ECF_LOOPING_CONST_OR_PURE when evaluating calls User-Agent: Notmuch/0.34.1 (https://notmuchmail.org) Emacs/27.2 (x86_64-suse-linux-gnu) Date: Tue, 30 Nov 2021 15:22:53 +0100 Message-ID: <ri6v909g1tu.fsf@suse.cz> 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Cc: Jan Hubicka <hubicka@ucw.cz> Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> |
Series |
ipa-sra: Check also ECF_LOOPING_CONST_OR_PURE when evaluating calls
|
|
Commit Message
Martin Jambor
Nov. 30, 2021, 2:22 p.m. UTC
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? Thanks, Martin gcc/ChangeLog: 2021-11-29 Martin Jambor <mjambor@suse.cz> PT ipa/103267 * ipa-sra.c (scan_function): Also check ECF_LOOPING_CONST_OR_PURE flag. --- gcc/ipa-sra.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Comments
On Tue, Nov 30, 2021 at 3:24 PM Martin Jambor <mjambor@suse.cz> 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. > Thanks, > > Martin > > > gcc/ChangeLog: > > 2021-11-29 Martin Jambor <mjambor@suse.cz> > > PT ipa/103267 > * ipa-sra.c (scan_function): Also check ECF_LOOPING_CONST_OR_PURE flag. > --- > gcc/ipa-sra.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/gcc/ipa-sra.c b/gcc/ipa-sra.c > index cb0e30507a1..12ccd049552 100644 > --- a/gcc/ipa-sra.c > +++ b/gcc/ipa-sra.c > @@ -1925,7 +1925,8 @@ scan_function (cgraph_node *node, struct function *fun) > if (lhs) > scan_expr_access (lhs, stmt, ISRA_CTX_STORE, bb); > int flags = gimple_call_flags (stmt); > - if ((flags & (ECF_CONST | ECF_PURE)) == 0) > + if (((flags & (ECF_CONST | ECF_PURE)) == 0) > + || (flags & ECF_LOOPING_CONST_OR_PURE)) > bitmap_set_bit (final_bbs, bb->index); > } > break; > -- > 2.33.1 >
On Tue, Nov 30 2021, Richard Biener wrote: > On Tue, Nov 30, 2021 at 3:24 PM Martin Jambor <mjambor@suse.cz> 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 <mjambor@suse.cz> 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); }
diff --git a/gcc/ipa-sra.c b/gcc/ipa-sra.c index cb0e30507a1..12ccd049552 100644 --- a/gcc/ipa-sra.c +++ b/gcc/ipa-sra.c @@ -1925,7 +1925,8 @@ scan_function (cgraph_node *node, struct function *fun) if (lhs) scan_expr_access (lhs, stmt, ISRA_CTX_STORE, bb); int flags = gimple_call_flags (stmt); - if ((flags & (ECF_CONST | ECF_PURE)) == 0) + if (((flags & (ECF_CONST | ECF_PURE)) == 0) + || (flags & ECF_LOOPING_CONST_OR_PURE)) bitmap_set_bit (final_bbs, bb->index); } break;