From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 29A7A3856DD9; Mon, 17 Apr 2023 11:06:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 29A7A3856DD9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681729581; bh=/7V/VkDxDQKemcWGOe74mc9I/KGBnryi4rrbJyQwBic=; h=From:To:Subject:Date:In-Reply-To:References:From; b=VS3eemEGDffBL6fcX2XUzHgwo7Y2M+Rcmd7yfe9FJZvrPw1zQA2UlnMTnXf6HAqX+ pABVGtLtIUZuUs7/PgyIl2KSNAwnfbhlYaUD7ngpjBgzeXbVuAQwkeiIpIo4UzuBFt mBJEwwV8lR7MaQ4EjUakOr1q/J8fosfoOc4h2k5A= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/109318] [12/13 Regression] csmith: -fipa-cp seems to cause trouble since r12-2523-g13586172d0b70c Date: Mon, 17 Apr 2023 11:06:20 +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: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: jamborm at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.3 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109318 --- Comment #11 from CVS Commits --- The master branch has been updated by Martin Jambor : https://gcc.gnu.org/g:8e08c7886eed5824bebd0e011526ec302d622844 commit r13-7206-g8e08c7886eed5824bebd0e011526ec302d622844 Author: Martin Jambor Date: Mon Apr 17 12:59:51 2023 +0200 ipa: Fix double reference-count decrements for the same edge (PR 107769= , PR 109318) It turns out that since addition of the code that can identify globals which are only read from, the code that keeps track of the references can decrement their count for the same calls, once during IPA-CP and then again during inlining. Fixed by adding a special flag to the pass-through variant and simply wiping out the reference to the refdesc structure from the constant ones. Moreover, during debugging of the issue I have discovered that the code removing references could remove a reference associated with the same statement but of a wrong type. In all cases it wanted to remove an IPA_REF_ADDR reference so removing a lesser one instead should do no harm in practice, but we should try to be consistent and so this patch extends symtab_node::find_reference so that it searches for a reference of a given type only. gcc/ChangeLog: 2023-04-14 Martin Jambor PR ipa/107769 PR ipa/109318 * cgraph.h (symtab_node::find_reference): Add parameter use_typ= e. * ipa-prop.h (ipa_pass_through_data): New flag refdesc_decremen= ted. (ipa_zap_jf_refdesc): New function. (ipa_get_jf_pass_through_refdesc_decremented): Likewise. (ipa_set_jf_pass_through_refdesc_decremented): Likewise. * ipa-cp.cc (ipcp_discover_new_direct_edges): Provide a value f= or the new parameter of find_reference. (adjust_references_in_caller): Likewise. Make sure the constant jump function is not used to decrement a refdec counter again. Only decrement refdesc counters when the pass_through jump function allows it. Added a detailed dump when decrementing refdesc counters. * ipa-prop.cc (ipa_print_node_jump_functions_for_edge): Dump new flag. (ipa_set_jf_simple_pass_through): Initialize the new flag. (ipa_set_jf_unary_pass_through): Likewise. (ipa_set_jf_arith_pass_through): Likewise. (remove_described_reference): Provide a value for the new param= eter of find_reference. (update_jump_functions_after_inlining): Zap refdesc of new jfun= c if the previous pass_through had a flag mandating that we do so. (propagate_controlled_uses): Likewise. Only decrement refdesc counters when the pass_through jump function allows it. (ipa_edge_args_sum_t::duplicate): Provide a value for the new parameter of find_reference. (ipa_write_jump_function): Assert the new flag does not have to= be streamed. * symtab.cc (symtab_node::find_reference): Add parameter use_ty= pe, use it in searching. gcc/testsuite/ChangeLog: 2023-04-06 Martin Jambor PR ipa/107769 PR ipa/109318 * gcc.dg/ipa/pr109318.c: New test. * gcc.dg/lto/pr107769_0.c: Likewise.=