public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-5195] Fix ipa-modref pure/const discovery
@ 2021-11-12 13:01 Jan Hubicka
  0 siblings, 0 replies; only message in thread
From: Jan Hubicka @ 2021-11-12 13:01 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:1b62cddcf091fb8cadf575246a7d3ff778650a6b

commit r12-5195-g1b62cddcf091fb8cadf575246a7d3ff778650a6b
Author: Jan Hubicka <jh@suse.cz>
Date:   Fri Nov 12 14:00:47 2021 +0100

    Fix ipa-modref pure/const discovery
    
            PR ipa/103200
            * ipa-modref.c (analyze_function, modref_propagate_in_scc): Do
            not mark pure/const function if there are side-effects.

Diff:
---
 gcc/ipa-modref.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c
index 72006251f29..44b3427a202 100644
--- a/gcc/ipa-modref.c
+++ b/gcc/ipa-modref.c
@@ -2790,7 +2790,8 @@ analyze_function (function *f, bool ipa)
 
   if (!ipa && flag_ipa_pure_const)
     {
-      if (!summary->stores->every_base && !summary->stores->bases)
+      if (!summary->stores->every_base && !summary->stores->bases
+	  && !summary->side_effects)
 	{
 	  if (!summary->loads->every_base && !summary->loads->bases)
 	    fixup_cfg = ipa_make_function_const
@@ -4380,7 +4381,8 @@ modref_propagate_in_scc (cgraph_node *component_node)
 	modref_summary_lto *summary_lto = summaries_lto
 					  ? summaries_lto->get (cur)
 					  : NULL;
-	if (summary && !summary->stores->every_base && !summary->stores->bases)
+	if (summary && !summary->stores->every_base && !summary->stores->bases
+	    && !summary->side_effects)
 	  {
 	    if (!summary->loads->every_base && !summary->loads->bases)
 	      pureconst |= ipa_make_function_const
@@ -4390,7 +4392,7 @@ modref_propagate_in_scc (cgraph_node *component_node)
 		     (cur, summary->side_effects, false);
 	  }
 	if (summary_lto && !summary_lto->stores->every_base
-	    && !summary_lto->stores->bases)
+	    && !summary_lto->stores->bases && !summary_lto->side_effects)
 	  {
 	    if (!summary_lto->loads->every_base && !summary_lto->loads->bases)
 	      pureconst |= ipa_make_function_const


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

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

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-12 13:01 [gcc r12-5195] Fix ipa-modref pure/const discovery Jan Hubicka

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