From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 775D33858416; Tue, 10 Jan 2023 13:21:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 775D33858416 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1673356860; bh=bU2AqFc+PEXa7MwrDQFCfIgu3qcXkeNfiFnzLvFVFtI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ZPe1VHbKNDHIvtxoO0FAtX2/nlnpsdh3xcNVsfkwGrT7pNL6sBUyp6olF9vg3oeRG sxBtUh1SUTmunmdeTbEwN6xveqITIFvDzs0vsICkr4oJi4jVBvjQDeLM0OTIfac/Fv 2CWGx4EabGmN06dy78T6/SfX9rt0apinDAvdtY1o= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/108110] [13 Regression] ice in modify_call, at ipa-param-manipulation.cc:700 with -std=c++14 -O3 -march=znver3 since r13-4685-g4834e9360f7bf4 Date: Tue, 10 Jan 2023 13:20:57 +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: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: jamborm at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 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=3D108110 --- Comment #18 from CVS Commits --- The master branch has been updated by Martin Jambor : https://gcc.gnu.org/g:c389991432da2bcc335a2b4fb7e502d28a6b3346 commit r13-5090-gc389991432da2bcc335a2b4fb7e502d28a6b3346 Author: Martin Jambor Date: Tue Jan 10 14:18:22 2023 +0100 ipa: Sort ipa_param_body_adjustments::m_replacements (PR 108110) The problem in PR 108110 is that elements describing the same base parameter in ipa_param_body_adjustments::m_replacements are not adjacent to each other, which is something that ipa_param_body_adjustments::modify_call_stmt when it gathers all replacements for a parameter. One option would be to simply always keep looking until the end of the vector (see bugzilla comment 15 for a one-line fix) but the correct thing to do is to keep the elements of the vector sorted and thus make such elements adjacent again. This patch does that and then also modifies the look-ups to take advantage of it. Since the one user of ipa_param_body_adjustments that is not tree-inline.cc, which is OpenMP declare SIMD cloning code, also registers its own replacements and in theory pointers to elements of the m_replacements vector can leak through public method get_expr_replacement, I decided that in those cases it is the responsibility of the user of the class to call the sorting method between the replacement registrations and the first lookup. That is why the patch also adds a line to omp-simd-clone.cc. gcc/ChangeLog: 2023-01-09 Martin Jambor PR ipa/108110 * ipa-param-manipulation.h (ipa_param_body_adjustments): New members sort_replacements, lookup_first_base_replacement and m_sorted_replacements_p. * ipa-param-manipulation.cc: Define INCLUDE_ALGORITHM. (ipa_param_body_adjustments::register_replacement): Set m_sorted_replacements_p to false. (compare_param_body_replacement): New function. (ipa_param_body_adjustments::sort_replacements): Likewise. (ipa_param_body_adjustments::common_initialization): Call sort_replacements. (ipa_param_body_adjustments::ipa_param_body_adjustments): Initialize m_sorted_replacements_p. (ipa_param_body_adjustments::lookup_replacement_1): Rework to u= se std::lower_bound. (ipa_param_body_adjustments::lookup_first_base_replacement): New function. (ipa_param_body_adjustments::modify_call_stmt): Use lookup_first_base_replacement. * omp-simd-clone.cc (ipa_simd_modify_function_body): Call adjustments->sort_replacements. gcc/testsuite/ChangeLog: 2023-01-04 Martin Jambor PR ipa/108110 * g++.dg/ipa/pr108110.C: New test.=