public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hubicka at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/105160] [12 regression] ipa modref marks functions with asm volatile as const or pure
Date: Tue, 05 Apr 2022 21:01:23 +0000	[thread overview]
Message-ID: <bug-105160-4-0bK8PDlnnD@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-105160-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105160

--- Comment #5 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
It is indeed missing logic to merge the side_effect and nondeterministic flag
while updating after inlining.  I am testing the following

diff --git a/gcc/ipa-modref.cc b/gcc/ipa-modref.cc
index acfd7d80ff8..556816ab429 100644
--- a/gcc/ipa-modref.cc
+++ b/gcc/ipa-modref.cc
@@ -5281,6 +5281,29 @@ ipa_merge_modref_summary_after_inlining (cgraph_edge
*edge)
       if (!ignore_stores)
        to_info_lto->stores->collapse ();
     }
+  /* Merge side effects and non-determinism.
+     PURE/CONST flags makes functions deterministic and if there is
+     no LOOPING_CONST_OR_PURE they also have no side effects.  */
+  if (!(flags & (ECF_CONST | ECF_NOVOPS | ECF_PURE))
+      || (flags & ECF_LOOPING_CONST_OR_PURE))
+    {
+      if (to_info)
+       {
+         if (!callee_info || callee_info->side_effects)
+           to_info->side_effects = true;
+         if ((!callee_info || callee_info->nondeterministic)
+             && !ignore_nondeterminism_p (edge->caller->decl, flags))
+           to_info->nondeterministic = true;
+       }
+      if (to_info_lto)
+       {
+         if (!callee_info_lto || callee_info_lto->side_effects)
+           to_info_lto->side_effects = true;
+         if ((!callee_info_lto || callee_info_lto->nondeterministic)
+             && !ignore_nondeterminism_p (edge->caller->decl, flags))
+           to_info_lto->nondeterministic = true;
+       }
+     }
   if (callee_info || callee_info_lto)
     {
       auto_vec <modref_parm_map, 32> parm_map;

  parent reply	other threads:[~2022-04-05 21:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-05 11:50 [Bug ipa/105160] New: " nsz at gcc dot gnu.org
2022-04-05 11:58 ` [Bug ipa/105160] " rguenth at gcc dot gnu.org
2022-04-05 12:19 ` rguenth at gcc dot gnu.org
2022-04-05 12:30 ` rguenth at gcc dot gnu.org
2022-04-05 14:54 ` hubicka at gcc dot gnu.org
2022-04-05 21:01 ` hubicka at gcc dot gnu.org [this message]
2022-04-06  7:08 ` peterz at infradead dot org
2022-04-06  7:10 ` peterz at infradead dot org
2022-04-07 14:46 ` jeremy.linton at arm dot com
2022-04-07 14:48 ` jeremy.linton at arm dot com
2022-04-09 19:11 ` hubicka at gcc dot gnu.org

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=bug-105160-4-0bK8PDlnnD@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).