From: hubicka Date: Wed, 28 Nov 2018 20:34:06 +0000 (+0000) Subject: * tree-ssa-ifcombine.c (update_profile_after_ifcombine): Handle X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02fa15302a63a5244d0e6e4859e44bf0d7685b00;p=thirdparty%2Fgcc.git * tree-ssa-ifcombine.c (update_profile_after_ifcombine): Handle profile_probability::always better. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@266585 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3c1f926e239f..bc49105e219f 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 b63c600c47b2..2b969378d650 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;