* cgraph.c (cgraph_edge::redirect_call_stmt_to_caller): Cleanup.
authorJan Hubicka <hubicka@ucw.cz>
Sun, 16 Jul 2017 16:36:48 +0000 (18:36 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Sun, 16 Jul 2017 16:36:48 +0000 (16:36 +0000)
From-SVN: r250243

gcc/ChangeLog
gcc/cgraph.c

index ccceea51091054ff27f1b8e1c20752dddece107e..c6491ffa5b2946132f3be03d3328bd083c98e098 100644 (file)
@@ -1,3 +1,7 @@
+2017-07-16  Jan Hubicka  <hubicka@ucw.cz>
+
+       * cgraph.c (cgraph_edge::redirect_call_stmt_to_caller): Cleanup.
+
 2017-07-16  Jan Hubicka  <hubicka@ucw.cz>
 
        * cfgloopmanip.c (scale_loop_profile): Avoid use of REG_BR_PROB_BASE
index 6711aeb828e70f0331c1071503ed232fcec0a855..2f820f1bb676164eb566bbd4188438c2aea58d90 100644 (file)
@@ -1315,19 +1315,19 @@ cgraph_edge::redirect_call_stmt_to_callee (void)
            }
          gcc_assert (e2->speculative);
          push_cfun (DECL_STRUCT_FUNCTION (e->caller->decl));
+
+         profile_probability prob = e->count.probability_in (e->count
+                                                             + e2->count);
+         if (prob.initialized_p ())
+           ;
+         else if (e->frequency || e2->frequency)
+           prob = profile_probability::probability_in_gcov_type
+                    (e->frequency, e->frequency + e2->frequency).guessed ();
+         else 
+           prob = profile_probability::even ();
          new_stmt = gimple_ic (e->call_stmt,
                                dyn_cast<cgraph_node *> (ref->referred),
-                               /* FIXME: cleanup. */
-                               profile_probability::from_reg_br_prob_base (
-                               e->count > profile_count::zero ()
-                               || e2->count > profile_count::zero ()
-                               ? e->count.probability_in
-                                  (e->count + e2->count).to_reg_br_prob_base ()
-                               : e->frequency || e2->frequency
-                               ? RDIV (e->frequency * REG_BR_PROB_BASE,
-                                       e->frequency + e2->frequency)
-                               : REG_BR_PROB_BASE / 2),
-                               e->count, e->count + e2->count);
+                               prob, e->count, e->count + e2->count);
          e->speculative = false;
          e->caller->set_call_stmt_including_clones (e->call_stmt, new_stmt,
                                                     false);