diff options
author | Jan Hubicka <hubicka@ucw.cz> | 2017-06-05 19:41:32 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2017-06-05 17:41:32 +0000 |
commit | aea5e79a63f965a9ed5fd2ef1943e3865495e987 (patch) | |
tree | 52c60043f6ed486d65cb1a8a38cb71979166465c /gcc/tree-inline.c | |
parent | 2f20e7db2caea4909ddff539b2419c9f34c907c4 (diff) | |
download | gcc-aea5e79a63f965a9ed5fd2ef1943e3865495e987.zip gcc-aea5e79a63f965a9ed5fd2ef1943e3865495e987.tar.gz gcc-aea5e79a63f965a9ed5fd2ef1943e3865495e987.tar.bz2 |
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
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r-- | gcc/tree-inline.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 7f20cdc..3298001 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -1763,7 +1763,8 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale, tree decl; gcov_type freq; basic_block prev; - bool scale = num.initialized_p () && den.initialized_p () && den > 0; + bool scale = num.initialized_p () + && (den > 0 || num == profile_count::zero ()); /* Search for previous copied basic block. */ prev = bb->prev_bb; @@ -2211,7 +2212,8 @@ copy_edges_for_bb (basic_block bb, profile_count num, profile_count den, gimple_stmt_iterator si; int flags; bool need_debug_cleanup = false; - bool scale = num.initialized_p () && den.initialized_p () && den > 0; + bool scale = num.initialized_p () + && (den > 0 || num == profile_count::zero ()); /* Use the indices from the original blocks to create edges for the new ones. */ @@ -2472,7 +2474,7 @@ initialize_cfun (tree new_fndecl, tree callee_fndecl, profile_count count) */ if (ENTRY_BLOCK_PTR_FOR_FN (src_cfun)->count.initialized_p () && count.initialized_p () - && ENTRY_BLOCK_PTR_FOR_FN (src_cfun)->count > 0) + && ENTRY_BLOCK_PTR_FOR_FN (src_cfun)->count.initialized_p ()) { ENTRY_BLOCK_PTR_FOR_FN (cfun)->count = ENTRY_BLOCK_PTR_FOR_FN (src_cfun)->count.apply_scale (count, @@ -2683,7 +2685,8 @@ copy_cfg_body (copy_body_data * id, profile_count count, int frequency_scale, profile_count incoming_count = profile_count::zero (); profile_count num = count; profile_count den = ENTRY_BLOCK_PTR_FOR_FN (src_cfun)->count; - bool scale = num.initialized_p () && den.initialized_p () && den > 0; + bool scale = num.initialized_p () + && (den > 0 || num == profile_count::zero ()); /* This can happen for COMDAT routines that end up with 0 counts despite being called (see the comments for handle_missing_profiles() |