From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 67C4E3858418; Tue, 31 Oct 2023 12:10:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 67C4E3858418 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1698754222; bh=MnDdLH4mqcvFA0ZtBLlXm6PY5uV2+Gv8fouLp3DYtkU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=oGkEX01lQJX+d1yhoVrv1bPuqdkkZh8OhPS7/neiDrueG9Ei6kWCP/t2nHwxs3Ydv Tpumx9RpnOdZpvX9XhSUdj2pMF2sx7UEq5F/5JlVXAF1XSjOh/P2PcZYz+4PVDcZ9q xe5ojSAfmKXDZzLfHe3t7HONICtsMM8zdIy3vKUw= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/112305] [11/12/13/14 Regression] Wrong code at -O1/2/3/s on x86_64-pc-linux-gnu Date: Tue, 31 Oct 2023 12:10:21 +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: 14.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: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.3 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=3D112305 --- Comment #5 from CVS Commits --- The master branch has been updated by Richard Biener : https://gcc.gnu.org/g:e3da1d7bb288c8c864f0284bc4bc5877b466a2f7 commit r14-5032-ge3da1d7bb288c8c864f0284bc4bc5877b466a2f7 Author: Richard Biener Date: Tue Oct 31 10:13:13 2023 +0100 tree-optimization/112305 - SCEV cprop and conditional undefined overflow The following adjusts final value replacement to also rewrite the replacement to defined overflow behavior if there's conditionally evaluated stmts (with possibly undefined overflow), not only when we "folded casts". The patch hooks into expression_expensive for this. PR tree-optimization/112305 * tree-scalar-evolution.h (expression_expensive): Adjust. * tree-scalar-evolution.cc (expression_expensive): Record when we see a COND_EXPR. (final_value_replacement_loop): When the replacement contains a COND_EXPR, rewrite it to defined overflow. * tree-ssa-loop-ivopts.cc (may_eliminate_iv): Adjust. * gcc.dg/torture/pr112305.c: New testcase.=