Hi,
this patch ICE where the profile in cgraph mismatch profile in BB. This is
becuase
of expansion of speculative devirtualization where we get some roundoff issues.
Bootstrapped/regtested x86_64-linux, comitted.
Honza
PR ipa/83619
* g++.dg/torture/pr83619.C: New testcase.
* cgraph.c (cgraph_edge::redirect_call_stmt_to_callee): Update edge
frequencies.
Index: cgraph.c
===================================================================
--- cgraph.c (revision 256847)
+++ cgraph.c (working copy)
@@ -1327,6 +1327,7 @@ cgraph_edge::redirect_call_stmt_to_calle
e->speculative = false;
e->caller->set_call_stmt_including_clones (e->call_stmt, new_stmt,
false);
+ e->count = gimple_bb (e->call_stmt)->count;
/* Fix edges for BUILT_IN_CHKP_BNDRET calls attached to the
processed call stmt. */
@@ -1346,6 +1347,7 @@ cgraph_edge::redirect_call_stmt_to_calle
}
e2->speculative = false;
+ e2->count = gimple_bb (e2->call_stmt)->count;
ref->speculative = false;
ref->stmt = NULL;
/* Indirect edges are not both in the call site hash.
Index: testsuite/g++.dg/torture/pr83619.C
===================================================================
--- testsuite/g++.dg/torture/pr83619.C (revision 0)
+++ testsuite/g++.dg/torture/pr83619.C (working copy)
@@ -0,0 +1,67 @@
+// { dg-do compile }
+int a;
+class d
+{
+public:
+ virtual unsigned c ();
+};
+class e;
+class i
+{
+ void h ();
+
+public:
+ void
+ operator= (e *f)
+ {
+ j<int>::c (f);
+ h ();
+ }
+ template <class> struct j
+ {
+ static void
+ c (e *g)
+ {
+ g->c ();
+ }
+ };
+};
+class k;
+class l
+{
+public:
+ l (int);
+ k *operator-> ();
+};
+class e : public d
+{
+};
+class m final : e
+{
+ unsigned c ();
+};
+class k
+{
+public:
+ virtual int o (e *) = 0;
+};
+class H : d, k
+{
+ int o (e *);
+ i n;
+};
+unsigned
+m::c ()
+{
+ l b = 0;
+ b->o (this);
+ return a;
+}
+int
+H::o (e *p)
+{
+ n = p;
+ return a;
+}
+
+