]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ipa-sra: Do not bail out when callers cannot be cloned
authorMartin Jambor <mjambor@suse.cz>
Wed, 5 May 2021 08:41:41 +0000 (10:41 +0200)
committerMartin Jambor <mjambor@suse.cz>
Thu, 6 May 2021 14:53:58 +0000 (16:53 +0200)
IPA-SRA fails to produce (very simple) edge summaries when a caller
cannot be cloned or its signature cannot be changed which makes it
less powerful for no good reason.  This patch fixes that problem.

gcc/ChangeLog:

2021-04-12  Martin Jambor  <mjambor@suse.cz>

* ipa-sra.c (ipa_sra_dump_all_summaries): Dump edge summaries even
when there is no function summary.
(ipa_sra_summarize_function): produce edge summaries even when
bailing out early.

gcc/testsuite/ChangeLog:

2021-04-12  Martin Jambor  <mjambor@suse.cz>

* gcc.dg/ipa/ipa-sra-1.c (main): Revert change done by
05193687dde, make the argv again pointer to an array.

gcc/ipa-sra.c
gcc/testsuite/gcc.dg/ipa/ipa-sra-1.c

index 7a89906cee637a55a18c482fa23b1e8c04e6a20c..3f90d4d81b681534c88ff34763eaf8e9a9b077b0 100644 (file)
@@ -2795,27 +2795,27 @@ ipa_sra_dump_all_summaries (FILE *f)
 
       isra_func_summary *ifs = func_sums->get (node);
       if (!ifs)
+       fprintf (f, "  Function does not have any associated IPA-SRA "
+                "summary\n");
+      else
        {
-         fprintf (f, "  Function does not have any associated IPA-SRA "
-                  "summary\n");
-         continue;
-       }
-      if (!ifs->m_candidate)
-       {
-         fprintf (f, "  Not a candidate function\n");
-         continue;
+         if (!ifs->m_candidate)
+           {
+             fprintf (f, "  Not a candidate function\n");
+             continue;
+           }
+         if (ifs->m_returns_value)
+           fprintf (f, "  Returns value\n");
+         if (vec_safe_is_empty (ifs->m_parameters))
+           fprintf (f, "  No parameter information. \n");
+         else
+           for (unsigned i = 0; i < ifs->m_parameters->length (); ++i)
+             {
+               fprintf (f, "  Descriptor for parameter %i:\n", i);
+               dump_isra_param_descriptor (f, &(*ifs->m_parameters)[i]);
+             }
+         fprintf (f, "\n");
        }
-      if (ifs->m_returns_value)
-         fprintf (f, "  Returns value\n");
-      if (vec_safe_is_empty (ifs->m_parameters))
-       fprintf (f, "  No parameter information. \n");
-      else
-       for (unsigned i = 0; i < ifs->m_parameters->length (); ++i)
-         {
-           fprintf (f, "  Descriptor for parameter %i:\n", i);
-           dump_isra_param_descriptor (f, &(*ifs->m_parameters)[i]);
-         }
-      fprintf (f, "\n");
 
       struct cgraph_edge *cs;
       for (cs = node->callees; cs; cs = cs->next_callee)
@@ -4063,7 +4063,10 @@ ipa_sra_summarize_function (cgraph_node *node)
     fprintf (dump_file, "Creating summary for %s/%i:\n", node->name (),
             node->order);
   if (!ipa_sra_preliminary_function_checks (node))
-    return;
+    {
+      isra_analyze_all_outgoing_calls (node);
+      return;
+    }
   gcc_obstack_init (&gensum_obstack);
   isra_func_summary *ifs = func_sums->get_create (node);
   ifs->m_candidate = true;
index df7e356daf358f98ee06dd4d3575cfc77227b95e..4a22e3978f9233ae6635de8cce3070846b5466a5 100644 (file)
@@ -24,7 +24,7 @@ ox (struct bovid cow)
 }
 
 int
-main (int argc, char **argv)
+main (int argc, char *argv[])
 {
   struct bovid cow;