Handle -fno-guess-branch-probability properly in predict.c (PR ipa/84825).
authorMartin Liska <mliska@suse.cz>
Tue, 20 Mar 2018 14:14:17 +0000 (15:14 +0100)
committerMartin Liska <marxin@gcc.gnu.org>
Tue, 20 Mar 2018 14:14:17 +0000 (14:14 +0000)
2018-03-20  Martin Liska  <mliska@suse.cz>

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  <mliska@suse.cz>

PR ipa/84825
* g++.dg/ipa/pr84825.C: New test.

From-SVN: r258683

gcc/ChangeLog
gcc/predict.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ipa/pr84825.C [new file with mode: 0644]

index 3a7ebc9e19d508931ed98c5cd5bbb0baf7ba6cf4..f47c1922f69bd9d26cfaba9e5b589f81f1108008 100644 (file)
@@ -1,3 +1,9 @@
+2018-03-20  Martin Liska  <mliska@suse.cz>
+
+       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  <jakub@redhat.com>
 
        PR target/84990
index b40dec47822c84dfff1f1ab2c1eb9bd2658f7606..019ff9e44cf4f0f93a7143652b5ac4d11c1aa848 100644 (file)
@@ -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);
index a59f09a2007e3990621813a421c76c7332c97066..6c918c0065bfb0d3be8d5650616c093b64e5c687 100644 (file)
@@ -1,3 +1,8 @@
+2018-03-20  Martin Liska  <mliska@suse.cz>
+
+       PR ipa/84825
+       * g++.dg/ipa/pr84825.C: New test.
+
 2018-03-20  Martin Liska  <mliska@suse.cz>
 
        * 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 (file)
index 0000000..7ae854e
--- /dev/null
@@ -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;