ipa-fnsummary.c (ipa_call_context::estimate_size_and_time, [...]): Micro optimize.
authorJan Hubicka <hubicka@ucw.cz>
Thu, 14 Nov 2019 13:38:13 +0000 (14:38 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Thu, 14 Nov 2019 13:38:13 +0000 (13:38 +0000)
* ipa-fnsummary.c (ipa_call_context::estimate_size_and_time,
ipa_merge_fn_summary_after_inlining): Micro optimize.

From-SVN: r278222

gcc/ChangeLog
gcc/ipa-fnsummary.c

index 42758b1097646919fd44a09f18d467f00b5daef3..c96683b1d1b739574ff3b9d6afe35beb06eecff2 100644 (file)
@@ -1,3 +1,8 @@
+2019-11-14  Jan Hubicka  <hubicka@ucw.cz>
+
+       * ipa-fnsummary.c (ipa_call_context::estimate_size_and_time,
+       ipa_merge_fn_summary_after_inlining): Micro optimize.
+
 2019-11-14  Jan Hubicka  <hubicka@ucw.cz>
 
        * params.opt (max-inline-insns-single-O2): Set to 70 (instead of 30).
index 9d8e1a566e30a01d725258c4ceb795fbc2a579f4..a88f300d67d47360d121e2610d67d27365599d3e 100644 (file)
@@ -3353,7 +3353,10 @@ ipa_call_context::estimate_size_and_time (int *ret_size,
                                                m_inline_param_summary);
              gcc_checking_assert (prob >= 0);
              gcc_checking_assert (prob <= REG_BR_PROB_BASE);
-             time += e->time * prob / REG_BR_PROB_BASE;
+             if (prob == REG_BR_PROB_BASE)
+               time += e->time;
+             else
+               time += e->time * prob / REG_BR_PROB_BASE;
            }
          gcc_checking_assert (time >= 0);
         }
@@ -3707,7 +3710,8 @@ ipa_merge_fn_summary_after_inlining (struct cgraph_edge *edge)
          sreal add_time = ((sreal)e->time * freq);
          int prob = e->nonconst_predicate.probability (callee_info->conds,
                                                        clause, es->param);
-         add_time = add_time * prob / REG_BR_PROB_BASE;
+         if (prob != REG_BR_PROB_BASE)
+           add_time = add_time * prob / REG_BR_PROB_BASE;
          if (prob != REG_BR_PROB_BASE
              && dump_file && (dump_flags & TDF_DETAILS))
            {