From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1B712385B510; Fri, 17 Feb 2023 17:20:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1B712385B510 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1676654459; bh=20JLiXLw20wbj3EBUHBaIQpVKv7XaBXfM6ZaGNS9Tvg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=OY9bztnch22fEIGANlBwa1XpH5qX7XNwGYbPjloNxJvfokiBFyFYEY/R8kh1wyllv TFEskftTQYK+V/mgex1IQxOBBqh2z0mFd1O/XKdPU77VH6Oip/xEjhkwRfV/99NSYb LTqdJnMRIwMVvuIB8xbtF3StPVH/F7mmtZUkZheA= From: "jamborm at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/107925] ICE in update_specialized_profile at gcc/ipa-cp.cc:5082 for 531.deepsjeng_r benchmark Date: Fri, 17 Feb 2023 17:20:58 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ipa X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jamborm at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jamborm at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: assigned_to bug_status Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107925 Martin Jambor changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |jamborm at gcc dot = gnu.org Status|NEW |ASSIGNED --- Comment #6 from Martin Jambor --- The assert is bogus, the "new" division of unexplained counts in the case of recursive functions so it can easily happen that what is left is less than what we're trying to take away. Having said that, there are a few more issues with the function, chief among them not dropping potentially guessed profiles to ipa. I'm going to test the following: diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc index 4b8dedc0c51..5a6b41cf2d6 100644 --- a/gcc/ipa-cp.cc +++ b/gcc/ipa-cp.cc @@ -5093,22 +5093,24 @@ update_specialized_profile (struct cgraph_node *new_node, profile_count redirected_sum) {=20 struct cgraph_edge *cs; - profile_count new_node_count, orig_node_count =3D orig_node->count; + profile_count new_node_count, orig_node_count =3D orig_node->count.ipa (= ); if (dump_file) {=20 fprintf (dump_file, " the sum of counts of redirected edges is "= ); redirected_sum.dump (dump_file); + fprintf (dump_file, "\n old ipa count of the original node is "); + orig_node_count.dump (dump_file); fprintf (dump_file, "\n"); } if (!(orig_node_count > profile_count::zero ())) return; - gcc_assert (orig_node_count >=3D redirected_sum); -=20=20 new_node_count =3D new_node->count; new_node->count +=3D redirected_sum; - orig_node->count -=3D redirected_sum; + orig_node->count + =3D lenient_count_portion_handling (orig_node->count - redirected_sum, + orig_node); for (cs =3D new_node->callees; cs; cs =3D cs->next_callee) cs->count +=3D cs->count.apply_scale (redirected_sum, new_node_count);=