From aea5e79a63f965a9ed5fd2ef1943e3865495e987 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Mon, 5 Jun 2017 19:41:32 +0200 Subject: cfgexpand.c (expand_gimple_tailcall): Initialize profile of new edge. * cfgexpand.c (expand_gimple_tailcall): Initialize profile of new edge. * ipa-inline.c (want_inline_self_recursive_call_p): Watch for missing profile in callgraph edge. * profile-count.h (apply_probability): If THIS is 0, then result is 0 (apply_scale): Likewise. * tree-inline.c (copy_bb, copy_edges_for_bb, copy_cfg_body): Also scale profile when inlining function with zero profile. (initialize_cfun): Update exit block profile even when it is zero. * tree-ssa-threadupdate.c (clear_counts_path): Handle correctly case when profile is read. From-SVN: r248885 --- gcc/profile-count.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'gcc/profile-count.h') diff --git a/gcc/profile-count.h b/gcc/profile-count.h index 2ac7f32..e7815db 100644 --- a/gcc/profile-count.h +++ b/gcc/profile-count.h @@ -221,6 +221,8 @@ public: profile_count apply_probability (int prob) const { gcc_checking_assert (prob >= 0 && prob <= REG_BR_PROB_BASE); + if (*this == profile_count::zero ()) + return *this; if (!initialized_p ()) return profile_count::uninitialized (); profile_count ret; @@ -230,6 +232,8 @@ public: /* Return *THIS * NUM / DEN. */ profile_count apply_scale (int64_t num, int64_t den) const { + if (*this == profile_count::zero ()) + return *this; if (!initialized_p ()) return profile_count::uninitialized (); profile_count ret; @@ -243,7 +247,7 @@ public: } profile_count apply_scale (profile_count num, profile_count den) const { - if (*this == profile_count::zero ()) + if (*this == profile_count::zero () || num == profile_count::zero ()) return profile_count::zero (); if (!initialized_p () || !num.initialized_p () || !den.initialized_p ()) return profile_count::uninitialized (); -- cgit v1.1