public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r10-10318] ipa-sra: Check also ECF_LOOPING_CONST_OR_PURE when evaluating calls
@ 2021-12-01 13:27 Martin Jambor
  0 siblings, 0 replies; only message in thread
From: Martin Jambor @ 2021-12-01 13:27 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:d2ecc42195e8af1992d12e678e761c73557eaf56

commit r10-10318-gd2ecc42195e8af1992d12e678e761c73557eaf56
Author: Martin Jambor <mjambor@suse.cz>
Date:   Wed Dec 1 14:25:16 2021 +0100

    ipa-sra: Check also ECF_LOOPING_CONST_OR_PURE when evaluating calls
    
    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.
    
    gcc/ChangeLog:
    
    2021-11-29  Martin Jambor  <mjambor@suse.cz>
    
            PR ipa/103267
            * ipa-sra.c (scan_function): Also check ECF_LOOPING_CONST_OR_PURE flag.
    
    (cherry picked from commit e5440bc08e07fd491dcccd47e1b86a5985ee117c)

Diff:
---
 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 8ad57493ea6..2f7fa9f9fc8 100644
--- a/gcc/ipa-sra.c
+++ b/gcc/ipa-sra.c
@@ -1912,7 +1912,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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-01 13:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-01 13:27 [gcc r10-10318] ipa-sra: Check also ECF_LOOPING_CONST_OR_PURE when evaluating calls Martin Jambor

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).