From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D189538346BB; Tue, 10 May 2022 08:22:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D189538346BB From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/103860] [9/10 Regression] wrong code at -O3 with -fPIC on x86_64-linux-gnu Date: Tue, 10 May 2022 08:22:24 +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: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: jakub at gcc dot gnu.org X-Bugzilla-Target-Milestone: 9.5 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, 10 May 2022 08:22:25 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103860 --- Comment #13 from CVS Commits --- The releases/gcc-10 branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:d88dde820ae61cde3f750b03f2dc4f6e6b4c52fc commit r10-10662-gd88dde820ae61cde3f750b03f2dc4f6e6b4c52fc Author: Jakub Jelinek Date: Thu Dec 30 14:23:18 2021 +0100 shrink-wrapping: Fix up prologue block discovery [PR103860] The following testcase is miscompiled, because a prologue which contains subq $8, %rsp instruction is emitted at the start of a basic block which contains conditional jump that depends on flags register set in an earlier basic block, the prologue instruction then clobbers those flags. Normally this case is checked by can_get_prologue predicate, but this is done only at the start of the loop. If we update pro later in the loop (because some bb shouldn't be duplicated) and then don't push anything further into vec and the vec is already empty (this can happen when the new pro is already in bb_with bitmask and either has no succes= sors (that is the case in the testcase where that bb ends with a trap) or all the successors are already in bb_with, then the loop doesn't iterate further and can_get_prologue will not be checked. The following simple patch makes sure we call can_get_prologue even aft= er the last former iteration when vec is already empty and only break from the loop afterwards (and only if the updating of pro done because of !can_get_prologue didn't push anything into vec again). 2021-12-30 Jakub Jelinek PR rtl-optimization/103860 * shrink-wrap.c (try_shrink_wrapping): Make sure can_get_prolog= ue is called on pro even if nothing further is pushed into vec. * gcc.dg/pr103860.c: New test. (cherry picked from commit 1820137ba624d7eb2004a10f9632498b6bc1696a)=