From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2FDBE3858C5F; Mon, 25 Dec 2023 04:02:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2FDBE3858C5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1703476931; bh=Vk8XRr2zNSg3T5xDLEc+0kDrLIzcyq5JftLN3PblZo8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=PW0Mk8DPrHkKrHMebl7cDqIKRZ335agN8doSpiYoM6rrTS9S0B9RjxYOGcDl45clx EOs87zt1E63t8RiZ381R5Ra4zGQ8qGr3oQcBhM5s/Sg5cGerA03cTmMCpf5X4rm0rS pRVPt62Z6s3c36mnwXbkXnKbCTra5BqqIaunjrkQ= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/19832] don't remove an if when we know the value is the same as with the if (subtraction) Date: Mon, 25 Dec 2023 04:02:07 +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: 4.0.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: pinskia at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D19832 --- Comment #14 from GCC Commits --- The trunk branch has been updated by Andrew Pinski : https://gcc.gnu.org/g:59ecd5ff096f800de17b804f1482055f2d84d629 commit r14-6827-g59ecd5ff096f800de17b804f1482055f2d84d629 Author: Andrew Pinski Date: Sun Dec 24 15:51:35 2023 -0800 match: Improve `(a !=3D b) ? (a + b) : (2 * a)` pattern [PR19832] In the testcase provided, we would match f_plus but not g_plus due to a missing `:c` on the plus operator. This fixes the oversight there. Note this was noted in https://github.com/llvm/llvm-project/issues/7631= 8 . Committed as obvious after bootstrap/test on x86_64-linux-gnu. PR tree-optimization/19832 gcc/ChangeLog: * match.pd (`(a !=3D b) ? (a + b) : (2 * a)`): Add `:c` on the plus operator. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/phi-opt-same-2.c: New test. Signed-off-by: Andrew Pinski =