From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 73BF63854146; Mon, 4 Jul 2022 19:02:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 73BF63854146 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/104869] [12 Regression] Miscompilation of qt5-qtdeclarative since r12-6342-ge7a7dbb5ca5dd696 Date: Mon, 04 Jul 2022 19:02:51 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: rsandifo at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.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 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: Mon, 04 Jul 2022 19:02:51 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104869 --- Comment #7 from CVS Commits --- The releases/gcc-11 branch has been updated by Richard Sandiford : https://gcc.gnu.org/g:d6a8ac7e92dfe0a51d71525e212147d0b84f1224 commit r11-10110-gd6a8ac7e92dfe0a51d71525e212147d0b84f1224 Author: Richard Sandiford Date: Mon Jul 4 20:02:26 2022 +0100 rtl-ssa: Fix prev/next_def confusion [PR104869] rtl-ssa chains definitions into an RPO list. It also groups sequences of clobbers together into a single node, so that it's possible to skip over the clobbers in constant time in order to get the next or previous set. When adding a clobber to an insn, the main DF barriers for that clobber are the last use of the previous set (if any) and the next set (if any); adding a new clobber to a sea of clobbers is fine. def_lookup provided the basis for these barriers as prev_def () and next_def (). But of course, in hindsight, those were bad names, since they implied that the returned values were literally the previous definition (of any kind) or the next definition (of any kind). And function_info::make_use_available was using the same routines assuming that they had that meaning. :-( This made a difference for the case where the start of a BB occurs in the middle of an (RPO) clobber group: we then want the previous and next clobbers in the group, rather than the set before the clobber group and the set after the clobber group. This patch renames the existing routines to something that's hopefully clearer (though also more long-winded). It then adds routines that really do provide the previous and next definitions. This complication is supposed to be internal to rtl-ssa and, as mentioned above, is part of trying to reduce time complexity. gcc/ PR middle-end/104869 * rtl-ssa/accesses.h (clobber_group::prev_clobber): Declare. (clobber_group::next_clobber): Likewise. (def_lookup::prev_def): Rename to... (def_lookup::last_def_of_prev_group): ...this. (def_lookup::next_def): Rename to... (def_lookup::first_def_of_next_group): ...this. (def_lookup::matching_or_prev_def): Rename to... (def_lookup::matching_set_or_last_def_of_prev_group): ...this. (def_lookup::matching_or_next_def): Rename to... (def_lookup::matching_set_or_first_def_of_next_group): ...this. (def_lookup::prev_def): New function, taking the lookup insn as argument. (def_lookup::next_def): Likewise. * rtl-ssa/member-fns.inl (def_lookup::prev_def): Rename to... (def_lookup::last_def_of_prev_group): ...this. (def_lookup::next_def): Rename to... (def_lookup::first_def_of_next_group): ...this. (def_lookup::matching_or_prev_def): Rename to... (def_lookup::matching_set_or_last_def_of_prev_group): ...this. (def_lookup::matching_or_next_def): Rename to... (def_lookup::matching_set_or_first_def_of_next_group): ...this. * rtl-ssa/movement.h (restrict_movement_for_dead_range): Update after above renaming. * rtl-ssa/accesses.cc (clobber_group::prev_clobber): New functi= on. (clobber_group::next_clobber): Likewise. (def_lookup::prev_def): Likewise. (def_lookup::next_def): Likewise. (function_info::make_use_available): Pass the lookup insn to def_lookup::prev_def and def_lookup::next_def. gcc/testsuite/ PR middle-end/104869 * g++.dg/pr104869.C: New test. (cherry picked from commit 4a3073f04e8b7987ad7bfe1bc23bfeb1d627ee6a)=