public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Fix ICE with -fno-guess-branch-probability
@ 2017-06-30 21:10 Jan Hubicka
  0 siblings, 0 replies; only message in thread
From: Jan Hubicka @ 2017-06-30 21:10 UTC (permalink / raw)
  To: gcc-patches

Hi,
this patch fixes a problem when -fno-guess-branch-probability is inlined into
expanded thunk.
When inlining, the profile status needs to be dropped to lowest common one
(well in theory we can avoid that when callee has only one BB or so).

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 249837)
+++ ChangeLog	(working copy)
@@ -1,3 +1,8 @@
+2017-06-29  Jan Hubicka  <hubicka@ucw.cz>
+
+	PR ipa/81261
+	* tree-inline.c (expand_call_inline): Combine profile statuses.
+
 2017-06-30  Richard Biener  <rguenther@suse.de>
 
 	* graph.c (draw_cfg_node_succ_edges): Fix broken dot syntax.
Index: testsuite/ChangeLog
===================================================================
--- testsuite/ChangeLog	(revision 249837)
+++ testsuite/ChangeLog	(working copy)
@@ -1,3 +1,8 @@
+2017-06-29  Jan Hubicka  <hubicka@ucw.cz>
+
+	PR ipa/81261
+	* g++.dg/ipa/pr81261.C: New testcase.
+
 2017-06-30  Nathan Sidwell  <nathan@acm.org>
 
 	PR c++/81229
Index: testsuite/g++.dg/ipa/pr81261.C
===================================================================
--- testsuite/g++.dg/ipa/pr81261.C	(revision 0)
+++ testsuite/g++.dg/ipa/pr81261.C	(working copy)
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fno-guess-branch-probability"  } */
+
+struct CBase {
+  virtual void BaseFunc () {}
+};
+
+struct MMixin {
+  virtual void * MixinFunc (int, void *) = 0;
+};
+
+struct CExample: CBase, public MMixin
+{
+  void *MixinFunc (int arg, void *arg2)
+  {
+    if (arg != 1 || arg2)
+      return 0;
+    return this;
+  }
+};
+
+void *test (MMixin & anExample)
+{
+  return anExample.MixinFunc (1, 0);
+}
+
+int main ()
+{
+  CExample c;
+  return (test (c) != &c);
+}
Index: tree-inline.c
===================================================================
--- tree-inline.c	(revision 249837)
+++ tree-inline.c	(working copy)
@@ -4650,6 +4650,9 @@ expand_call_inline (basic_block bb, gimp
   else
     id->dst_simt_vars = NULL;
 
+  if (profile_status_for_fn (id->src_cfun) == PROFILE_ABSENT)
+    profile_status_for_fn (dst_cfun) = PROFILE_ABSENT;
+
   /* If the src function contains an IFN_VA_ARG, then so will the dst
      function after inlining.  Likewise for IFN_GOMP_USE_SIMT.  */
   prop_mask = PROP_gimple_lva | PROP_gimple_lomp_dev;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-06-30 21:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-30 21:10 Fix ICE with -fno-guess-branch-probability Jan Hubicka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).