From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 08D023858406; Mon, 25 Apr 2022 07:52:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 08D023858406 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/100810] [12 Regression] wrong code at -O1 and above on x86_64-linux-gnu since r12-397-gda9e6e63d1ae22e530ec7baf59f6ed028bf05776 Date: Mon, 25 Apr 2022 07:52:43 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: patch, 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: P1 X-Bugzilla-Assigned-To: rguenth 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, 25 Apr 2022 07:52:44 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100810 --- Comment #14 from CVS Commits --- The master branch has been updated by Richard Biener : https://gcc.gnu.org/g:ab91c10792cd3a1ba1495aa30a34ca17b043bafb commit r12-8241-gab91c10792cd3a1ba1495aa30a34ca17b043bafb Author: Richard Biener Date: Fri Apr 1 11:30:00 2022 +0200 tree-optimization/100810 - avoid undefs in IVOPT rewrites The following attempts to avoid IVOPTs rewriting uses using IV candidates that involve undefined behavior by using uninitialized SSA names. First we restrict the set of candidates we produce for such IVs to the original ones and mark them as not important. Second we try to only allow expressing uses with such IV if they originally use them. That is to avoid rewriting all such uses in terms of other IVs. Since cand->iv and use->iv seem to never exactly match up we resort to comparing the IV bases. The approach ends up similar to the one posted by Roger at https://gcc.gnu.org/pipermail/gcc-patches/2021-August/578441.html but it marks IV candidates rather than use groups and the cases we allow in determine_group_iv_cost_generic are slightly different. 2022-01-04 Richard Biener PR tree-optimization/100810 * tree-ssa-loop-ivopts.cc (struct iv_cand): Add involves_undefs flag. (find_ssa_undef): New function. (add_candidate_1): Avoid adding derived candidates with undefined SSA names and mark the original ones. (determine_group_iv_cost_generic): Reject rewriting uses with a different IV when that involves undefined SSA names. * gcc.dg/torture/pr100810.c: New testcase. * gcc.dg/torture/pr105337.c: Likewise.=