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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
So what happens is that we split g(), the global load is in g.part and then
we inline things back, but ipa_merge_modref_summary_after_inlining has
no summary for g.part so we fail to merge the global load but we also
do not reset the callers summary.

Thus late modref comes along:

modref analyzing 'g/3' (ipa=0) (const)
Past summary:
  loads:
  stores:
  Try dse
Always executed bbbs (assuming return or EH): 2
 - Analyzing store: D.2993
   - Read-only or local, ignoring.
 - Analyzing load: c
   - Recording base_set=0 ref_set=0
 - modref done with result: tracked.

The following fixes this, not sure if summaries_lto needs similar treatment.
We might just bail out early as well, of course?  Honza?

diff --git a/gcc/ipa-modref.cc b/gcc/ipa-modref.cc
index 372f7354361..1e93070a1ea 100644
--- a/gcc/ipa-modref.cc
+++ b/gcc/ipa-modref.cc
@@ -5492,7 +5492,7 @@ ipa_merge_modref_summary_after_inlining (cgraph_edge
*edge)

   if (summaries)
     {
-      if (to_info && !to_info->useful_p (flags))
+      if ((to_info && !to_info->useful_p (flags)) || !callee_info)
        {
          if (dump_file)
            fprintf (dump_file, "Removed mod-ref summary for %s\n",

Reply via email to