From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7CF423853804; Fri, 8 Apr 2022 12:18:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7CF423853804 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/105198] [9/10/11/12 Regression] Wrong code for C loop (GCC 12 -O2, GCC 11 -O3) Date: Fri, 08 Apr 2022 12:18:44 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-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: rguenth 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: Fri, 08 Apr 2022 12:18:44 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105198 --- Comment #7 from CVS Commits --- The master branch has been updated by Richard Biener : https://gcc.gnu.org/g:e5453bcc217ea4ac53a4ac277661d6ef0ccd425b commit r12-8059-ge5453bcc217ea4ac53a4ac277661d6ef0ccd425b Author: Richard Biener Date: Fri Apr 8 13:13:29 2022 +0200 tree-optimization/105198 - wrong code with predictive commoning When predictive commoning looks for a looparound PHI it tries to match the entry value definition (a load) up with the appropriate member of the chain. But it fails to consider stmts clobbering the very same memory location inbetween the load and loop entry. In theory we could be more clever on must aliases that would be also picked up from a load (so not exactly stmt_kills_ref_p) and use the stored value from that if it is an exact match. But we currently have no way to propagate this information inside predcom. 2022-04-08 Richard Biener PR tree-optimization/105198 * tree-predcom.cc (find_looparound_phi): Check whether the found memory location of the entry value is clobbered inbetween the value we want to use and loop entry. * gcc.dg/torture/pr105198.c: New testcase.=