From 9c7a7155ec779fb56f462cb9b932ad09bc56c92a Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Wed, 28 Nov 2018 21:34:06 +0100 Subject: [PATCH] tree-ssa-ifcombine.c (update_profile_after_ifcombine): Handle profile_probability::always better. * tree-ssa-ifcombine.c (update_profile_after_ifcombine): Handle profile_probability::always better. From-SVN: r266585 --- gcc/ChangeLog | 5 +++++ gcc/tree-ssa-ifcombine.c | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3c1f926e239..bc49105e219 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2018-11-28 Jan Hubicka + + * tree-ssa-ifcombine.c (update_profile_after_ifcombine): Handle + profile_probability::always better. + 2018-11-28 Jan Hubicka * profile-count.h (profile_count::split): Give better result when diff --git a/gcc/tree-ssa-ifcombine.c b/gcc/tree-ssa-ifcombine.c index b63c600c47b..2b969378d65 100644 --- a/gcc/tree-ssa-ifcombine.c +++ b/gcc/tree-ssa-ifcombine.c @@ -360,8 +360,15 @@ update_profile_after_ifcombine (basic_block inner_cond_bb, inner_cond_bb->count = outer_cond_bb->count; - inner_taken->probability = outer2->probability + outer_to_inner->probability - * inner_taken->probability; + /* Handle special case where inner_taken probability is always. In this case + we know that the overall outcome will be always as well, but combining + probabilities will be conservative because it does not know that + outer2->probability is inverse of outer_to_inner->probability. */ + if (inner_taken->probability == profile_probability::always ()) + ; + else + inner_taken->probability = outer2->probability + outer_to_inner->probability + * inner_taken->probability; inner_not_taken->probability = profile_probability::always () - inner_taken->probability; -- 2.30.2