ipa-fnsummary.c (ipa_call_context::estimate_size_and_time): Fix calculation of min_size.
authorJan Hubicka <hubicka@ucw.cz>
Sat, 9 Nov 2019 17:45:29 +0000 (18:45 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Sat, 9 Nov 2019 17:45:29 +0000 (17:45 +0000)
* ipa-fnsummary.c (ipa_call_context::estimate_size_and_time): Fix
calculation of min_size.
(ipa_update_overall_fn_summary): Likewise.

From-SVN: r278006

gcc/ChangeLog
gcc/ipa-fnsummary.c

index 0d6b35def70858a608bebdac0e21300377f27cc3..e2bef8bc2a03a67e78e8daac1315e33e1660f41b 100644 (file)
@@ -1,3 +1,9 @@
+2019-11-09  Jan Hubicka  <hubicka@ucw.cz>
+
+       * ipa-fnsummary.c (ipa_call_context::estimate_size_and_time): Fix
+       calculation of min_size.
+       (ipa_update_overall_fn_summary): Likewise.
+
 2019-11-09  Jan Hubicka  <hubicka@ucw.cz>
 
        * ipa-fnsummary.c (estimate_edge_size_and_time): Do not call
index 569efdc794d45262717b2bf0744d4c9a9aae9805..941e732359f2917d1cb479466e937c4b9a06f556 100644 (file)
@@ -3243,6 +3243,7 @@ ipa_call_context::estimate_size_and_time (int *ret_size,
 
   sreal nonspecialized_time = time;
 
+  min_size += (*info->size_time_table)[0].size;
   for (i = 0; vec_safe_iterate (info->size_time_table, i, &e); i++)
     {
       bool exec = e->exec_predicate.evaluate (m_nonspec_possible_truths);
@@ -3288,7 +3289,7 @@ ipa_call_context::estimate_size_and_time (int *ret_size,
      }
   gcc_checking_assert ((*info->size_time_table)[0].exec_predicate == true);
   gcc_checking_assert ((*info->size_time_table)[0].nonconst_predicate == true);
-  min_size = (*info->size_time_table)[0].size;
+  gcc_checking_assert (min_size >= 0);
   gcc_checking_assert (size >= 0);
   gcc_checking_assert (time >= 0);
   /* nonspecialized_time should be always bigger than specialized time.
@@ -3685,12 +3686,13 @@ ipa_update_overall_fn_summary (struct cgraph_node *node)
       size_info->size += e->size;
       info->time += e->time;
     }
+  info->min_size = (*info->size_time_table)[0].size;
   estimate_calls_size_and_time (node, &size_info->size, &info->min_size,
                                &info->time, NULL,
                                ~(clause_t) (1 << predicate::false_condition),
                                vNULL, vNULL, vNULL);
-  size_info->size = (size_info->size + ipa_fn_summary::size_scale / 2)
-                   / ipa_fn_summary::size_scale;
+  size_info->size = RDIV (size_info->size, ipa_fn_summary::size_scale);
+  info->min_size = RDIV (info->min_size, ipa_fn_summary::size_scale);
 }