public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Jambor <mjambor@suse.cz>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] ipa-sra: Check also ECF_LOOPING_CONST_OR_PURE when evaluating calls
Date: Wed, 01 Dec 2021 18:29:12 +0100	[thread overview]
Message-ID: <ri6fsrcfd3r.fsf@suse.cz> (raw)
In-Reply-To: <CAFiYyc3_FDWx-V3_XOMn-kqoAEVn5JLcnT-9LbG_Y75FnAv2tw@mail.gmail.com>

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);
 		}
 
-- 
2.33.1


      reply	other threads:[~2021-12-01 17:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-30 14:22 Martin Jambor
2021-11-30 14:32 ` Richard Biener
2021-12-01 17:29   ` Martin Jambor [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ri6fsrcfd3r.fsf@suse.cz \
    --to=mjambor@suse.cz \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).