From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0F250385734F; Thu, 26 Oct 2023 18:58:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0F250385734F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1698346692; bh=gWSjEFitv1YVcYVnm1lIXWLIxzVUk7pf19y3at3bJgA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=eLvmRIc/skP2w7JCgks2d9eznC7chHeBcQzhm5uWW9y7jp/usdWcIVVtpejUaqrz6 fMll9q0+nKW3slRbWh4Hu0UIkhuez09gUWItIRP2pWV7YEvW48N8EngCAY0f0flGhV mCKkHhd6SJqDbLvsfYIHx+ak46iMlcQFhOch1uXE= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/111957] `a ? abs(a) : 0` is not simplified to just abs(a) Date: Thu, 26 Oct 2023 18:58:11 +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: 14.0 X-Bugzilla-Keywords: missed-optimization, patch X-Bugzilla-Severity: enhancement 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: pinskia at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- 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=3D111957 --- Comment #5 from CVS Commits --- The trunk branch has been updated by Andrew Pinski : https://gcc.gnu.org/g:662655e22dddf5392d9aa67fce45beee980e5454 commit r14-4955-g662655e22dddf5392d9aa67fce45beee980e5454 Author: Andrew Pinski Date: Tue Oct 24 23:13:18 2023 +0000 match: Simplify `a !=3D C1 ? abs(a) : C2` when C2 =3D=3D abs(C1) [PR111= 957] This adds a match pattern for `a !=3D C1 ? abs(a) : C2` which gets simp= lified to `abs(a)`. if C1 was originally *_MIN then change it over to use absu instead of abs. Bootstrapped and tested on x86_64-linux-gnu with no regressions. PR tree-optimization/111957 gcc/ChangeLog: * match.pd (`a !=3D C1 ? abs(a) : C2`): New pattern. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/phi-opt-40.c: New test.=