From 14b05bee0ccd7a6a9d7c6d498121caa4d6f9e23d Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Tue, 20 Mar 2018 15:14:17 +0100 Subject: [PATCH] Handle -fno-guess-branch-probability properly in predict.c (PR ipa/84825). 2018-03-20 Martin Liska PR ipa/84825 * predict.c (rebuild_frequencies): Handle case when we have PROFILE_ABSENT, but flag_guess_branch_prob is false. 2018-03-20 Martin Liska PR ipa/84825 * g++.dg/ipa/pr84825.C: New test. From-SVN: r258683 --- gcc/ChangeLog | 6 ++++++ gcc/predict.c | 3 +++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/ipa/pr84825.C | 18 ++++++++++++++++++ 4 files changed, 32 insertions(+) create mode 100644 gcc/testsuite/g++.dg/ipa/pr84825.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3a7ebc9e19d..f47c1922f69 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-03-20 Martin Liska + + PR ipa/84825 + * predict.c (rebuild_frequencies): Handle case when we have + PROFILE_ABSENT, but flag_guess_branch_prob is false. + 2018-03-20 Jakub Jelinek PR target/84990 diff --git a/gcc/predict.c b/gcc/predict.c index b40dec47822..019ff9e44cf 100644 --- a/gcc/predict.c +++ b/gcc/predict.c @@ -3998,6 +3998,9 @@ rebuild_frequencies (void) } else if (profile_status_for_fn (cfun) == PROFILE_READ) update_max_bb_count (); + else if (profile_status_for_fn (cfun) == PROFILE_ABSENT + && !flag_guess_branch_prob) + ; else gcc_unreachable (); timevar_pop (TV_REBUILD_FREQUENCIES); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a59f09a2007..6c918c0065b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-03-20 Martin Liska + + PR ipa/84825 + * g++.dg/ipa/pr84825.C: New test. + 2018-03-20 Martin Liska * gcc.dg/lto/chkp-ctor-merge_0.c: Remove. diff --git a/gcc/testsuite/g++.dg/ipa/pr84825.C b/gcc/testsuite/g++.dg/ipa/pr84825.C new file mode 100644 index 00000000000..7ae854e7140 --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr84825.C @@ -0,0 +1,18 @@ +/* PR ipa/84658 */ +/* { dg-options "-O3 --param early-inlining-insns=0 -fno-guess-branch-probability" } */ + +struct a; +struct b; +struct c { + virtual a *d(b *); +}; +struct a { + virtual a e(); +}; +struct f { + virtual ~f(); +}; +struct g : f, a {}; +struct b : c, virtual g { + b *d(b *h) { return h; } +} i; -- 2.30.2