aboutsummaryrefslogtreecommitdiff
path: root/gcc/predict.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2013-09-04 16:14:28 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2013-09-04 14:14:28 +0000
commit61a74079b01d0229d95f14d160bcbe6c4f88147f (patch)
tree37a2f18b9ddc64a6fda6a6cc4c075c72734d0ce7 /gcc/predict.c
parent24ba81955d92ff8c29f814867b887446f5c0be05 (diff)
downloadgcc-61a74079b01d0229d95f14d160bcbe6c4f88147f.zip
gcc-61a74079b01d0229d95f14d160bcbe6c4f88147f.tar.gz
gcc-61a74079b01d0229d95f14d160bcbe6c4f88147f.tar.bz2
Makefile.in (ipa-devirt.o): Add dependency on diagnostic.h
* Makefile.in (ipa-devirt.o): Add dependency on diagnostic.h * ipa-devirt.c: Include diganostic.h (odr_type_d): Add types and types_set. (hash_type_name): Work for types with vtables during LTO. (odr_hasher::remove): Fix comment; destroy types_set. (add_type_duplicate): New function, (get_odr_type): Use it. (dump_type_inheritance_graph): Dump type duplicates. * ipa.c (symtab_remove_unreachable_nodes): Build type inheritance graph. * tree.c (types_same_for_odr): Give exact answers on types with virtual tables. From-SVN: r202258
Diffstat (limited to 'gcc/predict.c')
-rw-r--r--gcc/predict.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/gcc/predict.c b/gcc/predict.c
index 06da1cd..ddf72d2 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -232,8 +232,22 @@ bool
probably_never_executed_bb_p (struct function *fun, const_basic_block bb)
{
gcc_checking_assert (fun);
- if (profile_info && flag_branch_probabilities)
- return ((bb->count + profile_info->runs / 2) / profile_info->runs) == 0;
+ if (profile_status_for_function (fun) == PROFILE_READ)
+ {
+ if ((bb->count * 4 + profile_info->runs / 2) / profile_info->runs > 0)
+ return false;
+ if (!bb->frequency)
+ return true;
+ if (!ENTRY_BLOCK_PTR->frequency)
+ return false;
+ if (ENTRY_BLOCK_PTR->count && ENTRY_BLOCK_PTR->count < REG_BR_PROB_BASE)
+ {
+ return (RDIV (bb->frequency * ENTRY_BLOCK_PTR->count,
+ ENTRY_BLOCK_PTR->frequency)
+ < REG_BR_PROB_BASE / 4);
+ }
+ return true;
+ }
if ((!profile_info || !flag_branch_probabilities)
&& (cgraph_get_node (fun->decl)->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED))