From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 209833851C1B; Tue, 16 Mar 2021 15:44:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 209833851C1B From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/98078] ICE in cgraph_add_edge_to_call_site_hash, at cgraph.c:698 since r6-1705-gd88511aec7338a93 Date: Tue, 16 Mar 2021 15:44:29 +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: 11.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 15:44:29 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98078 --- Comment #7 from CVS Commits --- The releases/gcc-10 branch has been updated by Martin Jambor : https://gcc.gnu.org/g:27dca33bc5c52971c00d1657560aeabae8f35d18 commit r10-9449-g27dca33bc5c52971c00d1657560aeabae8f35d18 Author: Martin Jambor Date: Tue Mar 16 16:42:41 2021 +0100 ipa: Fix resolving speculations through cgraph_edge::set_call_stmt In the PR 98078 testcase, speculative call-graph edges which were created by IPA-CP are confirmed during inlining but cgraph_edge::set_call_stmt does not take it very well. The function enters the update_speculative branch and updates the edges in the speculation bundle separately (by a recursive call), but when it processes the first direct edge, most of the bundle actually ceases to exist because it is devirtualized. It nevertheless goes on to attempt to update the indirect edge (that has just been removed), which surprisingly gets as far as adding the edge to the call_site_hash, the same devirtualized edge for the second time, and that triggers an assert. Fixed by this patch which makes the function aware that it is about to resolve a speculation and do so instead of updating components of speculation. Also, it does so before dealing with the hash because the speculation resolution code needs the hash to point to the first speculative direct edge and also cleans the hash up by calling update_call_stmt_hash_for_removing_direct_edge. Bootstrapped and tested on x86_64-linux, also profile-LTO-bootstrapped on the same system. gcc/ChangeLog: 2021-01-20 Martin Jambor PR ipa/98078 * cgraph.c (cgraph_edge::set_call_stmt): Do not update all corresponding speculative edges if we are about to resolve sepculation. Make edge direct (and so resolve speculations) be= fore removing it from call_site_hash. (cgraph_edge::make_direct): Relax the initial assert to allow calling the function on speculative direct edges. (cherry picked from commit b8188b7d7382e4a74af5dd6a125e76e8d43a68a5)=