Hi.

This is a fix for situation where we use -fno-guess-branch-probability and 
fnsplit happens.

Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

Ready for trunk?
Thanks,
Martin

gcc/ChangeLog:

2018-03-13  Martin Liska  <mli...@suse.cz>

        PR ipa/84825
        * predict.c (rebuild_frequencies): Handle case when we have
        PROFILE_ABSENT, but flag_guess_branch_prob is false.

gcc/testsuite/ChangeLog:

2018-03-13  Martin Liska  <mli...@suse.cz>

        * g++.dg/ipa/pr84825.C: New test.
---
 gcc/predict.c                      |  3 +++
 gcc/testsuite/g++.dg/ipa/pr84825.C | 18 ++++++++++++++++++
 2 files changed, 21 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/ipa/pr84825.C


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/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;

Reply via email to