ipa-profile.c (ipa_propagate_frequency_1): Use count instead of frequency.
authorJan Hubicka <hubicka@ucw.cz>
Thu, 23 Nov 2017 15:59:07 +0000 (16:59 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Thu, 23 Nov 2017 15:59:07 +0000 (15:59 +0000)
* ipa-profile.c (ipa_propagate_frequency_1): Use count instead of
frequency.
* cgraph.c (cgraph_edge::dump_edge_flags): Dump sreal frequencies.
(cgraph_edge::maybe_hot_p): Use sreal frequencies.

From-SVN: r255104

gcc/ChangeLog
gcc/cgraph.c
gcc/ipa-profile.c

index 56b9473bc5e47cde9f29a3e811cea0629bd5db0b..b9852e98e832bb424e76b579d57b3b01e69356f9 100644 (file)
@@ -1,3 +1,10 @@
+2017-11-23  Jan Hubicka  <hubicka@ucw.cz>
+
+       * ipa-profile.c (ipa_propagate_frequency_1): Use count instead of
+       frequency.
+       * cgraph.c (cgraph_edge::dump_edge_flags): Dump sreal frequencies.
+       (cgraph_edge::maybe_hot_p): Use sreal frequencies.
+
 2017-11-23  Jan Hubicka  <hubicka@ucw.cz>
 
        * ipa-fnsummary.c (record_modified_bb_info): Use sreal
index 69eb9bb2341b13435b2c38c606e2db9b2edf471b..7ac58ce91c1aea4145b87f8175f68a377c0c35d3 100644 (file)
@@ -2024,7 +2024,7 @@ cgraph_edge::dump_edge_flags (FILE *f)
       fprintf (f, "(");
       count.dump (f);
       fprintf (f, ",");
-      fprintf (f, "%.2f per call) ", frequency () / (double)CGRAPH_FREQ_BASE);
+      fprintf (f, "%.2f per call) ", sreal_frequency ().to_double ());
     }
   if (can_throw_external)
     fprintf (f, "(can throw external) ");
@@ -2811,15 +2811,11 @@ cgraph_edge::maybe_hot_p (void)
   if (symtab->state < IPA_SSA)
     return true;
   if (caller->frequency == NODE_FREQUENCY_EXECUTED_ONCE
-      && frequency () < CGRAPH_FREQ_BASE * 3 / 2)
+      && sreal_frequency () * 2 < 3)
+    return false;
+  if (PARAM_VALUE (HOT_BB_FREQUENCY_FRACTION) == 0
+      || sreal_frequency () * PARAM_VALUE (HOT_BB_FREQUENCY_FRACTION) <= 1)
     return false;
-  if (opt_for_fn (caller->decl, flag_guess_branch_prob))
-    {
-      if (PARAM_VALUE (HOT_BB_FREQUENCY_FRACTION) == 0
-         || frequency () <= (CGRAPH_FREQ_BASE
-                          / PARAM_VALUE (HOT_BB_FREQUENCY_FRACTION)))
-        return false;
-    }
   return true;
 }
 
@@ -3880,9 +3876,7 @@ cgraph_node::has_thunk_p (cgraph_node *node, void *)
   return false;
 }
 
-/* Expected frequency of executions within the function.
-   When set to CGRAPH_FREQ_BASE, the edge is expected to be called once
-   per function call.  The range is 0 to CGRAPH_FREQ_MAX.  */
+/* Expected frequency of executions within the function.  */
 
 sreal
 cgraph_edge::sreal_frequency ()
index cdcd0505f030e2c23c45cc7fa1d0670229d6500e..7c7c0d0faea42e069c1615ba89573cebeabcb85e 100644 (file)
@@ -340,7 +340,7 @@ ipa_propagate_frequency_1 (struct cgraph_node *node, void *data)
                  && edge->caller->global.inlined_to->frequency
                     != NODE_FREQUENCY_UNLIKELY_EXECUTED)))
          d->maybe_unlikely_executed = false;
-      if (!edge->frequency ())
+      if (edge->count.initialized_p () && !edge->count.nonzero_p ())
        continue;
       switch (edge->caller->frequency)
         {