Fix early exit in modref_merge_call_site_flags
authorJan Hubicka <jh@suse.cz>
Sun, 19 Dec 2021 21:28:40 +0000 (22:28 +0100)
committerJan Hubicka <jh@suse.cz>
Sun, 19 Dec 2021 21:29:37 +0000 (22:29 +0100)
When adding support for static chain and return slot flags I forgot to update
early exit condition in modref_merge_call_site_flags.  This yields to wrong
code as demonstrated by the Fortran testcase attached to PR (which I hope
someone will help me to turn into testuite one).

gcc/ChangeLog:

2021-12-19  Jan Hubicka  <hubicka@ucw.cz>

PR ipa/103766
* ipa-modref.c (modref_merge_call_site_flags): Fix early exit condition

gcc/ipa-modref.c

index d3590f0..9c411a6 100644 (file)
@@ -5019,9 +5019,15 @@ modref_merge_call_site_flags (escape_summary *sum,
   bool changed = false;
   bool ignore_stores = ignore_stores_p (caller, callee_ecf_flags);
 
-  /* If we have no useful info to propagate.  */
-  if ((!cur_summary || !cur_summary->arg_flags.length ())
-      && (!cur_summary_lto || !cur_summary_lto->arg_flags.length ()))
+  /* Return early if we have no useful info to propagate.  */
+  if ((!cur_summary
+       || (!cur_summary->arg_flags.length ()
+          && !cur_summary->static_chain_flags
+          && !cur_summary->retslot_flags))
+      && (!cur_summary_lto
+         || (!cur_summary_lto->arg_flags.length ()
+             && !cur_summary_lto->static_chain_flags
+             && !cur_summary_lto->retslot_flags)))
     return false;
 
   FOR_EACH_VEC_ELT (sum->esc, i, ee)